Problem C
Arachnophobia
Jimmy is performing in ByteLand today! Anthony the Ant is a huge fan of Jimmy’s music, so he can’t wait to get to the concert.
ByteLand consists of of
Unfortunately for Anthony, he has a huge fear of spiders and
ByteLand is full of spiders. Spiders reside at certain
intersections in ByteLand. Anthony will choose a path from
Input
The first line contains three integers
Each of the next
The next line contains
The last line contains a integer
Output
Print the maximum
Sample Input 1 | Sample Output 1 |
---|---|
4 4 3000 0 1 1 1 3 1 2 0 2018 2 3 42 0 3 1 1 |
1 |
Sample Input 2 | Sample Output 2 |
---|---|
4 4 10 0 1 1 1 3 1 2 0 2018 2 3 42 0 3 1 1 |
0 |