//import java.util.*;
//
//public class Main
//{
// public static void main(String[] args)
// {
// Scanner t = new Scanner(System.in);
// int a[][] = new int[11][11];
// for(int i=0; i<9; i++)
// {
// for(int j=0; j<9; j++)
// {
// a[i][j] = t.nextInt();
// }
// }
// int y = t.nextInt();
// int x = t.nextInt();
// int cnt = 0;
//
//
// if(a[y-1][x-1]==0 && y-2>=0 && x-2>=0)
// {
// cnt+=a[y-2][x-2]+a[y-2][x-1]+a[y-2][x];
// cnt+=a[y-1][x-2]+a[y-1][x];
// cnt+=a[y][x-2]+a[y][x-1]+a[y][x];
// }
// else if(a[y-1][x-1]==0 && x-2>=0&&y==1)
// {
// cnt+=a[y-1][x-2]+a[y-1][x];
// cnt+=a[y][x-2]+a[y][x-1]+a[y][x];
// }
// else if(a[y-1][x-1]==0 && x==1 && y-2>=0)
// {
// cnt+=a[y-2][x-1]+a[y-2][x];
// cnt+=a[y-1][x];
// cnt+=a[y][x-1]+a[y][x];
// }
// else if(a[y-1][x-1]==0 && x==1 && y==1)
// {
// cnt+=a[y-1][x];
// cnt+=a[y][x-1]+a[y][x];
// }
// else if(a[y-1][x-1]==1)
// {
// cnt=-1;
// }
//
// System.out.println(cnt);
// }
//}