Nuclear Waste


You are traversing a nuclear wasteland, trying to make it back to your hideout. You are currently at location 11, and your hideout is at location nn. Certain locations contain nuclear waste, and you want to stay as far from waste as possible.

Locations are connected by one-way paths. Each path has a length and may also provide food. If you traverse the same path again, you gain that same amount of food again.

Define the safety of a route as the minimum distance from any location on the route to the nearest waste site. Distance to waste is measured along path lengths, but for this distance computation every path is treated as undirected (you may measure through a path in either direction even though you can only travel it in one direction).

Among all routes from 11 to nn, maximize safety. Among all routes that achieve that maximum safety, maximize the total food collected. If you can collect arbitrarily large amounts of food while keeping that maximum safety (by looping), the food answer is infinite.

Input

The first line contains the integers nn, mm, and ww: the number of locations, number of paths, and number of waste locations respectively.

The second line contains ww distinct integers, the locations that contain nuclear waste.

The following mm lines each contain integers aa, bb, cc, and dd: a directed path from aa to bb with length cc and food dd.

Locations are numbered 11 through nn.

It is guaranteed that there exists a path from location 11 to the hideout.

Output

Print two integers: the maximum safety, and the maximum food achievable at that safety. If the food is infinite, print -1 instead of the food amount.

Constraints

  • 2≤n≤2002 \le n \le 200
  • 1≤m≤5001 \le m \le 500
  • 1≤w≤n1 \le w \le n
  • 1≤a,b≤n1 \le a, b \le n
  • 1≤c≤1091 \le c \le 10^9
  • 0≤d≤1090 \le d \le 10^9

Example 1

Input 1
3 3 1
2
1 2 3 10
2 3 4 10
1 3 1 1
Output 1
3 1
Explanation

Waste is only at location 22, so the waste distances are 33, 00, and 44 for locations 11, 22, and 33. The route 1→2→31 \to 2 \to 3 has safety 00. The route 1→31 \to 3 has safety min⁡(3,4)=3\min(3, 4) = 3 and food 11, which is best.

Example 2

Input 2
10 20 2
5 7
1 2 10 0
2 3 10 0
3 4 7 0
4 5 4 0
5 6 10 0
6 7 3 0
7 8 8 0
8 9 10 0
9 10 9 9
10 1 8 0
5 9 2 0
8 7 1 2
7 7 2 0
1 1 1 0
9 10 1 6
8 5 1 0
9 4 3 0
10 6 3 2
2 1 1 0
3 10 3 7
Output 2
3 -1
Explanation

The maximum safety is 33. On routes that keep that safety there is a positive-food cycle that can still reach the hideout, so the food answer is infinite.

Example 3

Input 3
10 20 1
6
1 2 4 0
2 3 4 6
3 4 8 0
4 5 4 0
5 6 3 0
6 7 5 0
7 8 8 0
8 9 1 0
9 10 10 0
10 1 2 7
9 4 3 0
10 3 3 0
8 7 3 0
5 5 1 0
6 3 2 0
2 2 3 9
5 9 3 10
4 10 3 0
8 2 1 0
2 7 2 9
Output 3
5 -1
Explanation

There is a route to the hideout with safety 55 on which you can loop and collect unbounded food, so the second number is -1.

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.