Two Trees

아직 제출이 없습니다시간 제한8초메모리 제한256 MB

문제

Given are trees T_1T\_1 and T_2T\_2. Each tree has nn vertices numbered from 11 through nn. Let d(v,u,T)d(v, u, T) denote the number of edges on the path between vertices vv and uu in tree TT. Calculate the following sum:

_1u<vn(d(v,u,T_1)+d(v,u,T_2))2.\sum\_{1 \le u < v \le n} \left(d(v, u, T\_1) + d(v, u, T\_2)\right)^2 \text{.}

As the answer may be large, find it modulo 2322^{32}.

입력

The first line contains one integer nn: the number of vertices in each tree (1n100,0001 \le n \le 100\\,000).

Each of the next n1n - 1 lines contains two integers, uu and vv, denoting an edge between vertices uu and vv in tree T_1T\_1 (1u,vn1 \le u, v \le n).

Each of the last n1n - 1 lines contains two integers, uu and vv, denoting an edge between vertices uu and vv in tree T_2T\_2 (1u,vn1 \le u, v \le n).

출력

Print the answer modulo 2322^{32}.