Given a directed and complete graph with vertices, compute the maximum cost of all the paths with the vertices in increasing order. The given graph is represented by an matrix , where for every pair with , is the (perhaps negative) cost of the arc from to .
For instance, the maximum cost of the first test is 100, because of the path , with cost .
Input consists of the number of vertices , followed by the matrix ( lines, each one with integer numbers), followed by the initial vertex . Vertices are numbered from 0 to . You can assume , that the diagonal has only zeros, and that the rest of numbers are between and .
Print the maximum cost of all the paths with the vertices in increasing order.
Input
6 0 20 5 -3 80 -2 11 0 30 -10 -12 3 22 -10 0 -50 15 -5 23 -60 35 0 90 7 97 14 -70 -11 0 -11 1 2 3 4 5 0
Output
100
Input
1 0
Output
0
Input
3 0 -6 8 -4 0 9 -7 -2 0
Output
9