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.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main implements Runnable {
		int[][] horsh = new int[12][12];
		int co[] = new int[8];
		int fi[] = new int[8];
		
	private void solve() throws IOException {
		co[0]=2;	fi[0]=1;
		co[1]=1;	fi[1]=2;
		co[2]=-1;	fi[2]=2;
		co[3]=-2;	fi[3]=1;
		co[4]=-2;	fi[4]=-1;
		co[5]=-1;	fi[5]=-2;
		co[6]=1;	fi[6]=-2;
		co[7]=2;	fi[7]=-1;
		
		String rook = next();
		int column = dimecolumn( rook.charAt(0) );
		int fila = rook.charAt(1) - '0';
		rookdale( column+1 , fila+1 );
		
		String knight = next();
		int column1 = dimecolumn( knight.charAt(0) );
		int fila1 = knight.charAt(1) - '0';
		knightdale( column1 , fila1 );
		
		for( int i=0 ; i<=1 ; i++ ){
			for( int j=0 ; j<=11 ; j++ ){
				horsh[i][j] = 0;
			}
		}
		for( int i=0 ; i<=11 ; i++ ){
			for( int j=0 ; j<=1 ; j++ ){
				horsh[i][j] = 0;
			}
		}
		for( int i=10 ; i<=11 ; i++ ){
			for( int j=0 ; j<=11 ; j++ ){
				horsh[i][j] = 0;
			}
		}
		for( int i=0 ; i<=11 ; i++ ){
			for( int j=10 ; j<=11 ; j++ ){
				horsh[i][j] = 0;
			}
		}
		/*for( int i=2 ; i<=9 ; i++ ){
			for( int j=2 ; j<=9 ; j++ ){
				out.print(horsh[i][j]+" ");
			}
			out.println();	
		}*/
		int suma = 0;
		for(int i=2 ; i<=9 ; i++){
			for(int j = 2; j <= 9 ; j++) {
				if( todo(i,j)==1 ){
					suma++;
					//out.println(i+" "+j+" true");
				}
			}
		}
		out.println(suma);
		/*int i = nextInt();
		int j = nextInt();
		if(todo(i,j)==true){
			out.println("YES");
		}
		else
			out.println("NO");*/
	}

	private int todo(int i, int j) {
		if( horsh[i][j]==1 || horsh[i][j]==2){
			return 0;
		}
		else{
			for(int k=0 ; k<=7 ; k++){
				if( horsh[i+fi[k]][j+co[k]] == 1 ){
					return 0;
				}
				
			}
		}
		return 1;
	}

	private void knightdale(int column1, int fila1) {
		horsh[fila1+1][column1+1]=1;
		for(int i=0 ; i<=7 ; i++){
			horsh[fi[i]+fila1+1][co[i]+column1+1]=2;
		}
	}

	private void rookdale(int column, int fila) {
		for( int i=2 ; i<=9 ; i++ ){horsh[i][column]=2; }
		for( int i=2 ; i<=9 ; i++ ){horsh[fila][i]=2; }
		horsh[fila][column]=1;
	}

	private int dimecolumn(char x) {
		return( x - 'a' + 1 );
	}

	public static void main(String[] args) {
		new Thread(new Main()).start();
	}

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;
	boolean eof = false;

	public void run() {
		Locale.setDefault(Locale.US);
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			st = new StringTokenizer("");
			solve();
			in.close();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(566);
		}
	}

	String next() {
		while (!st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(in.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(next());
	}

	long nextLong() {
		return Long.parseLong(next());
	}

	double nextDouble() {
		return Double.parseDouble(next());
	}

}
