Floyd#975

Floyd

1 second
128 megabytes
Very easy

Given a directed weighted graph, find the pair of vertices such that the shortest distance from one to the other is maximal among all pairs of vertices.

Input

The first line contains the number of vertices (1 \le n \le 100). The next lines each contain numbers and represent the weight matrix of the graph. A value of means there is no edge between the corresponding vertices; any non-negative number represents the weight of an edge. All elements on the main diagonal are always zero.

Output

Print the required maximum shortest distance.

Examples

Example 1

Loading
Loading