Depth Search#4000

Depth Search

1 second
128 megabytes
Easy

The undirected unweighted graph with one selected vertex is given. Find the number of vertices in the connected component containing the selected vertex (including the selected vertex itself).

Input

The first line contains the number of vertices and the selected vertex s~(1 \le s \le n \le 100). The next lines contain integers each — the adjacency matrix of a graph, where means the absence of an edge, and means the presence of an edge. It is guaranteed that the main diagonal of the matrix contains zeros.

Output

Print the desired number of vertices.

Examples

Example 1

Loading
Loading

Example 5

Loading
Loading