시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.5 초 512 MB45252358.974%

문제

The army of $x$ clones sneaked into the spaceship "Death Star" to help Luke Skywalker battling with Darth Vader. The spaceship consists of $n$ rooms and $m$ bidirectional passages between them. The clones start in the room 1 and want to go to the room $n$, where Luke is.

However every room is guarded by droids, room $i$ is guarded by $a_i$ droids. When the clones appear in the room, the battle between them and the droids starts. If the number of clones is greater than the number of droids, the clones will kill all the droids and all the clones will stay alive. Otherwise the clones will kill all droids as well, but they will lose half of the army: if there are $x$ clones at the beginning of the battle, then there will be $\left \lfloor \frac{x}{2} \right \rfloor$ clones at the end of battle, rounded down. The clones have to battle in all rooms they would visit, including rooms 1 and $n$.

Help the captain of the army to count the maximum number of clones that can come from the room 1 to the room $n$ .

입력

The first line contains two integers $n$ and $m$ --- number of rooms and passages in "Death Star" ($1 \le n, m \le 2 \cdot 10^5$).

The following $m$ lines describe passages: the $i$-th passage is described by two integers $u_i$ and $v_i$ --- the rooms that are connected by the passage ($1 \le u_i, v_i \le n$, $u_i \neq v_i$). It is guaranteed that every pair of rooms is connected by at most one passage.

The next line contains an integer $x$ --- the number of clones in the army ($1 \le x \le 10^9$).

The last line contains $n$ integers $a_1, a_2, \ldots, a_n$ --- the number of droids in the rooms ($1 \le a_i \le 10^9$).

출력

Print a single integer --- the maximum number of clones that can go from room 1 to room $n$. If there is no path to follow, so that at least one clone survives, print 0.

예제 입력 1

4 4
1 2
1 3
2 4
3 4
7
10 2 3 1

예제 출력 1

3

예제 입력 2

4 4
1 2
1 3
2 4
3 4
7
10 3 3 1

예제 출력 2

0