Dipu Bhai lives in a country called Chocoland. There are cities in Chocoland. The cities are numbered from to . The cities of Chocoland can be represented as a tree.
There is a cost associated with every city. It is called the tour cost. Tour cost of city is denoted by an integer , means Dipu Bhai has to pay exactly amount of money to visit the city . Dipu Bhai has amount of money. He wants to visit the cities of Chocoland. But he has a limited money and can not visit all the cities. So, he is interested in how many city he can visit and such that in a simple path from to he can visit all the cities and the sum of tour cost of all the cities from to (inclusive and ) does not exceed .
In this problem you have to solve for independent queries of .
The first line contains a single integer number of cities in Chocoland.
The next line contains space-separated integers tour cost of the cities. Tour cost of city is .
The following lines contain two space-separated integers and describe city and city are connected by a bidirectional edge.
The next line contains an integer number of queries.
The following line contains a single integer amount of money Dipu Bhai has.
It is guaranteed that the given edges will form a tree.
For each query print a single integer the number of cities and Dipu Bhai can visit spending not more than amount of money.
5 3 2 4 1 9 1 2 1 3 2 4 2 5 3 2 5 7
2 8 12
Chocoland in Sample 1: For the valid pairs of cities are , , , , , , , , , , and .
8 6 1 8 2 9 5 5 3 1 2 1 3 1 4 2 5 2 6 3 7 7 8 5 1 2 5 10 100
1 2 5 20 64