CF1486F Pairs of Paths

Description

You are given a tree consisting of $ n $ vertices, and $ m $ simple vertex paths. Your task is to find how many pairs of those paths intersect at exactly one vertex. More formally you have to find the number of pairs $ (i, j) $ $ (1 \leq i < j \leq m) $ such that $ path_i $ and $ path_j $ have exactly one vertex in common.

Input Format

N/A

Output Format

N/A

Explanation/Hint

![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1486F/a19cd21d095785ac889753153b27201ab276d741.png) The tree in the first example and paths look like this. Pairs $ (1,4) $ and $ (3,4) $ intersect at one vertex. In the second example all three paths contain the same single vertex, so all pairs $ (1, 2) $ , $ (1, 3) $ and $ (2, 3) $ intersect at one vertex. The third example is the same as the first example with two additional paths. Pairs $ (1,4) $ , $ (1,5) $ , $ (2,5) $ , $ (3,4) $ , $ (3,5) $ , $ (3,6) $ and $ (5,6) $ intersect at one vertex.