The Bayview Music department is going to Ottawa! As such, magicalsoup is planning the trip, more specifically, the number of buses needed for trips between cities. There are () cities in the town of Ottawa. Among these cities, () of them have been designated as tourist attractions. Currently, the coach bus company offers () one-way trips, where road that travels from city to city and costs the music department () amount of money. For each of these trips, at least one of and is a tourist attraction. There is at most one direct trip between cities in any given direction, and no trip starts and ends at the same city.
magicalsoup has been given () one way trips by Dr.Z. Where the -th request is from city to city . Can you help magicalsoup figure out the total number of trips that are possible, and the minimum total cost for them (the music department is lacking some money).
The first line contains 4 integers , , , and .
Each of the following lines contains 3 integers , and , there is a road between and with cost of .
Each of the following lines contains an integer , the tourist attraction cities.
Each of the following lines contains two integers and , indicating a trip from city to city .
The first line contains one integer, the number of trips that are possible.
The second line contains one integer, the minimum total cost of fulfilling the possible trips.
3 3 1 2 1 2 10 2 3 10 2 1 5 2 1 3 3 1
For the first request, the only possible route is , costing . There are no trips leaving from city , so the trip is not possible.