T155003 Rin's Tree
题目背景

题目描述
KagamineRin has a tree $T1$,KagamineLen has another tree $T2$, both of the two trees have $n$ nodes,numbered $1 \sim n$.
KagamineLen defined $LCA(T,x,y)$ means the numbering of the least common ancestor of the nodes $x$ and $y$ of tree $T$
KagamineRin wants to know how many pairs of integer $(i,j)(1 \le i < j \le n)$ that $LCA(T1,i,j) = LCA(T2,i,j)$
镜音铃有一棵树 $T1$ ,镜音连有一棵树 $T2$ ,每棵树都有$n$个节点,编号$1~n$。
求有多少点对$(i,j)$使得:
在$T1$上编号为$i,j$的节点的$LCA$的编号 等于 在$T2$上编号为$i,j$的节点的$LCA$的编号。
输入格式
第一行,三个正整数$n,r1,r2$,分别表示节点个数,T1的根,T2的根.
后面$n-1$行,每行$2$个正整数$u,v$表示第一棵树的边.
再后面$n-1$行,每行$2$个正整数$u,v$表示第二棵树的边.
输出格式
一行一个数,表示答案.
说明/提示
$n \le 10^6$