Two chess pieces, a rook and a knight, stand on a standard chessboard 8 × 8 in size. The positions in which they are situated are known. It is guaranteed that none of them beats the other one.

Your task is to find the number of ways to place another knight on the board so that none of the three pieces on the board beat another one. A new piece can only be placed on an empty square.

Input

The first input line contains the description of the rook's position on the board. This description is a line which is 2 in length. Its first symbol is a lower-case Latin letter from a to h, and its second symbol is a number from 1 to 8. The second line contains the description of the knight's position in a similar way. It is guaranteed that their positions do not coincide.

Output

Print a single number which is the required number of ways.

Examples

Input

a1
b2


Output

44


Input

a8
d4


Output

38

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class N38B {
	static int[][][]sprs;
	static int[]log;
	static PrintWriter out;
	public static void main(String[]args) throws IOException {
		Scanner sc=new Scanner(System.in);
		out=new PrintWriter(System.out);
		String rk=sc.next(),kn=sc.next();
		int board[][]=new int[8][8];
		int i1=rk.charAt(0)-'a',j1=rk.charAt(1)-'1';
		int i2=kn.charAt(0)-'a',j2=kn.charAt(1)-'1';
		for(int i=0;i<8;i++) {
			board[i][j1]=i==i1?2:1;
		}
		for(int j=0;j<8;j++) {
			board[i1][j]=j==j1?2:1;
		}
		int[]dx=new int[] {2,2,-2,-2,1,1,-1,-1};
		int[]dy=new int[] {1,-1,1,-1,2,-2,2,-2};
		board[i2][j2]=2;
		for(int i=0;i<8;i++) {
			if(valid(i2+dx[i],j2+dy[i])) {
				board[i2+dx[i]][j2+dy[i]]=1;
			}
		}
		int sum=0;
		for(int i=0;i<8;i++) {
			for(int j=0;j<8;j++) {
				if(board[i][j]==0) {
					int k=0;
					for(;k<8;k++) {
						if(valid(i+dx[k],j+dy[k])&&board[i+dx[k]][j+dy[k]]==2) {
							break;
						}
					}
					if(k==8)sum++;
				}
			}
		}
		out.println(sum);
		//disp(board);
		out.close();
	}
	private static void disp(boolean[][]board) {
		for(int i=0;i<8;i++) {
			for(int j=0;j<8;j++) {
				out.print(board[i][j]+" ");
			}
			out.println();
		}
	}
	private static boolean valid(int i, int j) {
		return i>=0&&i<8&&j>=0&&j<8;
	}
	static class Scanner 
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public String next() throws IOException 
		{
			while (st == null || !st.hasMoreTokens()) 
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public boolean hasNext() {return st.hasMoreTokens();}
		public int nextInt() throws IOException {return Integer.parseInt(next());}
		
		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}
			
		public boolean ready() throws IOException {return br.ready(); }
		public int[] nextArrInt(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
		public long[] nextArrLong(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

	}
}
