#arc125f. [arc125_f]Tree Degree Subset Sum
[arc125_f]Tree Degree Subset Sum
Problem Statement
Given is a tree with vertices. The vertices are numbered through , and the -th edge connects Vertex and Vertex .
Find the number of pairs of integers that satisfy the following conditions.
-
.
-
There is a way to choose exactly vertices from the tree so that the sum of their degrees equals .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3
1 2
2 3
Sample Output 1
6
The following six pairs satisfy the conditions.
, for example, satisfies the condition because choosing Vertex and Vertex achieves the total degree of .
Sample Input 2
5
1 2
2 3
2 4
4 5
Sample Output 2
16
Sample Input 3
10
2 9
8 10
2 10
4 6
5 6
1 8
2 7
3 6
6 8
Sample Output 3
65