Maximum by minimum#4819

Maximum by minimum

1 second
128 megabytes
Very easy

A directed unweighted graph is given. For a specified vertex , find a vertex from which the shortest distance to is maximized among all vertices, and output this maximal shortest distance.

Input

The first line contains three positive integers , , and (1 \le s \le n \le 5000, 1 \le m \le 20000) — the number of vertices, the number of edges in the graph, and the index of the specified vertex, respectively. Each of the next lines contains two integers, the start and end vertices of an edge.

Output

Print the maximum shortest distance from any vertex to .

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading