HackerLand is a tree consisting of cities connected by undirected roads where each road has length . Ann, Bob, and Clara are whistleblowing citizens living in secret. You want to track them down for an interview using the following pieces of information:
They live in three different cities expressed as some unordered triplet, , where , , and are the three different cities where Ann, Bob, and Clara live.
We consider two unordered triplets to be different if one triplet contains an integer not present in the other triplet. For example, and are the same because they both contain the same exact elements, but and are different because both triplets differ by one value.
- The distances between cities , , and form another unordered triplet, , that reduces to , where , , and are given values and is any real number.
For example, suppose , , , and HackerLand looks like this:
In this example, it's possible for Ann, Bob, and Clara to live in cities defined by the unordered triplet , and we express the distances between these cities as . If , then we can rewrite as ; note that because these are unordered triplets, is the same as .
Given , , , and a map of HackerLand, calculate and print the number of different unordered triplets that correspond to the possible locations of Ann, Bob, and Clara.
Input Format
The first line contains four space-separated integers describing the respective values of , , , and .
Each of the subsequent lines contains two space-separated integers, and , defining an undirected road connecting city to city .
Constraints
- For of the test cases, .
- For of the test cases, .
- For of the test cases, .
Output Format
Print the number of different unordered triplets that correspond to the possible locations of Ann, Bob, and Clara.
Sample Input 0
5 1 2 1
1 2
1 3
3 4
4 5
Sample Output 0
4
Explanation 0
In the diagram below, the green nodes depict all possible cities where Ann, Bob, and Clara might live for the given map of HackerLand when , , and :
Because there are four possible unordered triplets, we print as our answer.