#graph104. ATM

ATM

ATM

Problem Source

APIO 2009

Problem Description

The roads in the city of Siruseri are all one-way, and different roads connect at intersections. By law, every intersection has a Siruseri Bank ATM installed. Strangely, Siruseri's bars are also located at intersections, though not every intersection has a bar.

Banditji plans to carry out the most earth-shaking ATM robbery in the history of Siruseri. He will start from the city center, drive along the one-way roads, rob every ATM he passes, and finally celebrate his victory at a bar. Using superb hacking skills, he learned the amount of cash that can be grabbed from each ATM. He wants you to help him compute the maximum total cash he can rob by the time he reaches some bar, starting from the city center. He may pass through the same intersection or road any number of times, but once he has robbed an ATM, it will have no more money left in it.

Find the maximum total cash he can rob.

Input Format

The first line contains two integers N,MN, M (1≤N,M≤5×1051 \leq N, M \leq 5 \times 10^5). NN is the number of intersections and MM is the number of roads.

The next MM lines each contain two integers (both between 11 and NN); the two integers on the (i+1)(i+1)-th line are the start and end intersection numbers of the ii-th road.

The next NN lines each contain one integer, giving the amount of money in the ATM at each intersection in order. Each ATM is guaranteed to hold a non-negative integer amount not exceeding 40004000.

The next line contains two integers S,PS, P, where SS is the index of the city center (the starting intersection) and PP is the number of bars.

The following line contains PP integers, the indices of the intersections that have bars.

The input guarantees that you can reach at least one bar from the city center along the one-way roads of Siruseri.

Output Format

Output one integer: the maximum total cash Banditji can rob, starting from the city center and ending at some bar.

Sample Input

6 7
1 2
2 3
3 5
2 4
4 1
2 6
6 5
10
12
8
16
1
5
1 4
4
3
5
6

Sample Output

47

Constraints

  • 1≤N,M≤5×1051 \leq N, M \leq 5 \times 10^5
  • ATM amounts are non-negative integers ≤4000\leq 4000