/**
#include <stdio.h>
typedef struct
{
int x;
int y;
} q;
int nx, ny, tx, ty, n, rear = -1, front = -1;
int arr[1001][1001] = {};
q queue[10000001];
int dx[8] = {1, 2, 2, 1, -1, -2, -2, -1};
int dy[8] = {2, 1, -1, -2, -2, -1, 1, 2};
int is_in(int a, int b){
if (arr[a][b] == 1) return 0;
return !(a < 1 || a > n || b < 1 || b > n);
}
int main()
{
int i, k, cnt = 0;
int px, py;
scanf("%d %d %d %d %d", &n, &nx, &ny, &tx, &ty);
// 나이트 시작 위치 push
rear ++;
queue[rear].x = nx;
queue[rear].y = ny;
while(front != rear){
int ooo = rear;
for (k = front + 1 ; k <= ooo ; k ++)
{
front ++;
px = queue[front].x;
py = queue[front].y;
for (i = 0 ; i < 8 ; i ++)
{
int z = is_in(px + dx[i], py + dy[i]);
if (z == 0) continue;
if(px + dx[i]==tx && py + dy[i]==ty){
printf("%d", cnt + 1);
return 0;
}
rear ++;
queue[rear].x = px + dx[i];
queue[rear].y = py + dy[i];
arr[queue[rear].x][queue[rear].y] = 1;
///printf("%d %d\n",px + dx[i],py + dy[i]);
}
}
cnt ++;
///printf("\n");
}
return 0;
}
**/
#include <stdio.h>
int main()
{
int i, j, k, n, m;
int arr[101][101] = {};
scanf("%d %d", &n, &m);
for (i = 1 ; i <= n ; i ++)
{
for (j = 1 ; j <= m ; j ++)
{
scanf("%d", &arr[i][j]);
}
}
return 0;
}