You are given a tree with N nodes. Each node i has a value associated with it. You are asked to perform Q queries on it.
Each query contains an integer i.
In each query, you need to remove the edge and find number of connected unordered pair of nodes such that .
Note :
The tree is restored to it's original state after each query.
Input :
The first line of the input contains three single space separated integers and Q.
The next line of the input contains N single space separated integers denoting .
Each of the next lines contains two space separated integers u and v , the nodes that the edge connects (Edges are ordered by 1 based index).
Each of the next Q lines of the input contains an integer i corresponding to that query.
Output :
For each query, print the total number of connected unordered pairs such that .
Constraints :
In the query, i.e when the edge is removed, the pairs {1,2},{4,5} and {4,6} satisfies the required conditions.