In the Republic of JOI, there are cities numbered from 1 to . The cities are connected with roads. People in the Republic of JOI are travelling between cities using these roads. They can pass each of the roads in both directions. They can travel between any two cities by passing through one or several roads.
Mr. IOI is a candidate for the president of the Republic of JOI. Of course, to become the president, he must perform the campaign for the presidential election. His secretary made plans for the election campaign. In the -th plan, Mr. IOI will travel from the city to the city passing through minimum number of roads, and make a public speech in each of the cities on the way (including the city and the city ). Because his secretary is brilliant, it is known that Mr. IOI will get votes if the -th plan is performed. It is possible to perform several plans.
However, people in the Republic of JOI are impatient. If Mr. IOI makes public speeches more than once in the same city, he will lose the support from people in the Republic of JOI.
Because Mr. IOI would like to become the president, he wants to get as many votes as possible. Since you are a superprogrammer in the Republic of JOI, he asked you to write a program which calculates the maximum number of votes Mr. IOI can get in the presidential election under the assumption that he will not make public speeches more than once in the same city.
Task
Given the number of cities in the Republic of JOI, the information on the roads, the number of plans for the election campaign, and information of each plan, write a program which calculates the maximum number of votes Mr. IOI can get in the presidential election.
输入格式
Read the following data from the standard input.
The first line of input contains an integer , the number of cities in the Republic of JOI.
The -th line () of the following lines contains two space separated integers . This means the -th road connects the city and the city .
The following one line contains an integer , the number of plans for the election campaign.
The -th line () of the following lines contains three space separated integers . This means, in the -th plan, Mr. IOI will travel from the city to the city passing through minimum number of roads, and he will get votes if this plan is performed.
输出格式
The output should consist of one line, and contain one integer which denotes the maximum number of votes Mr. IOI can get in the presidential election.