Army of Clones

아직 제출이 없습니다시간 제한1.5초메모리 제한512 MB

문제

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

However every room is guarded by droids, room ii is guarded by a_ia\_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 xx clones at the beginning of the battle, then there will be x2\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 nn.

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

입력

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

The following mm lines describe passages: the ii-th passage is described by two integers u_iu\_i and v_iv\_i --- the rooms that are connected by the passage (1u_i,v_in1 \le u\_i, v\_i \le n, u_iv_iu\_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 xx --- the number of clones in the army (1x1091 \le x \le 10^9).

The last line contains nn integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n --- the number of droids in the rooms (1a_i1091 \le a\_i \le 10^9).

출력

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