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.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
 
public class Solution38B {
        
        final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE")!=null;
        BufferedReader in;
        PrintWriter out;
        StringTokenizer tok = new StringTokenizer("");
        
        void init() throws FileNotFoundException{
                if (ONLINE_JUDGE){
                        in = new BufferedReader(new InputStreamReader(System.in));
                        out = new PrintWriter(System.out);
                }else{
                        in = new BufferedReader(new FileReader("input.txt"));
                        out = new PrintWriter("output.txt");
                }
        }
        
        String readString() throws IOException{
                while(!tok.hasMoreTokens()){
                        tok = new StringTokenizer(in.readLine());
                }
                return tok.nextToken();
        }
        
        int readInt() throws IOException{
                return Integer.parseInt(readString());
        }
        
        long readLong() throws IOException{
                return Long.parseLong(readString());
        }
        
        double readDouble() throws IOException{
                return Double.parseDouble(readString());
        }
        
        public static void main(String[] args){
                new Solution38B().run();
        }
        
        public void run(){
                try{
                        long t1 = System.currentTimeMillis();
                        init();
                        solve();
                        out.close();
                        long t2 = System.currentTimeMillis();
                        System.err.println("Time = "+(t2-t1));
                }catch (Exception e){
                        e.printStackTrace(System.err);
                        System.exit(-1);
                }
        }
        
        void solve() throws IOException{
        	String l = readString();
        	int ly = l.charAt(0) - 'a';
        	int lx = l.charAt(1) - '1';
        	String k = readString();
        	int ky = k.charAt(0) - 'a';
        	int kx = k.charAt(1) - '1';
        	boolean[][] beat = new boolean[8][8];
        	for(int i = 0; i < 8; i++){
        		beat[lx][i] = true;
        		beat[i][ly] = true;
        	}
        	if(kx > 1 && ky > 0){
        		beat[kx-2][ky-1] = true;
        	}
        	if(kx > 1 && ky < 7){
        		beat[kx-2][ky+1] = true;
        	}
        	if(kx > 0 && ky > 1){
        		beat[kx-1][ky-2] = true;
        	}
        	if(kx > 0 && ky < 6){
        		beat[kx-1][ky+2] = true;
        	}
        	if(kx < 7 && ky > 1){
        		beat[kx+1][ky-2] = true;
        	}
        	if(kx < 7 && ky < 6){
        		beat[kx+1][ky+2] = true;
        	}
        	if(kx < 6 && ky > 0){
        		beat[kx+2][ky-1] = true;
        	}
        	if(kx < 6 && ky < 7){
        		beat[kx+2][ky+1] = true;
        	}
        	if(lx > 1 && ly > 0){
        		beat[lx-2][ly-1] = true;
        	}
        	if(lx > 1 && ly < 7){
        		beat[lx-2][ly+1] = true;
        	}
        	if(lx > 0 && ly > 1){
        		beat[lx-1][ly-2] = true;
        	}
        	if(lx > 0 && ly < 6){
        		beat[lx-1][ly+2] = true;
        	}
        	if(lx < 7 && ly > 1){
        		beat[lx+1][ly-2] = true;
        	}
        	if(lx < 7 && ly < 6){
        		beat[lx+1][ly+2] = true;
        	}
        	if(lx < 6 && ly > 0){
        		beat[lx+2][ly-1] = true;
        	}
        	if(lx < 6 && ly < 7){
        		beat[lx+2][ly+1] = true;
        	}
        	beat[kx][ky] = true;
        	int count = 0;
        	for(int i = 0; i < 8; i++){
        		for(int j = 0; j < 8; j++){
        			if(!beat[i][j]) count++;
        		}
        	}
        	out.println(count);
        }
        
        int ModExp(int a, int n, int mod){
        	int res = 1;
        	while (n!=0)
        		if ((n & 1) != 0) {
        			res = (res*a)%mod;
        			--n;
        		}
        		else {
        			a = (a*a)%mod;
        			n >>= 1;
        		}
        	return res;
        }
        
        
        static class Utils {
 
                private Utils() {}
 
                public static void mergeSort(int[] a) {
                        mergeSort(a, 0, a.length - 1);
                }
 
                private static void mergeSort(int[] a, int leftIndex, int rightIndex) {
                        final int MAGIC_VALUE = 50;
                        if (leftIndex < rightIndex) {
                                if (rightIndex - leftIndex <= MAGIC_VALUE) {
                                        insertionSort(a, leftIndex, rightIndex);
                                } else {
                                        int middleIndex = (leftIndex + rightIndex) / 2;
                                        mergeSort(a, leftIndex, middleIndex);
                                        mergeSort(a, middleIndex + 1, rightIndex);
                                        merge(a, leftIndex, middleIndex, rightIndex);
                                }
                        }
                }
 
                private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {
                        int length1 = middleIndex - leftIndex + 1;
                        int length2 = rightIndex - middleIndex;
                        int[] leftArray = new int[length1];
                        int[] rightArray = new int[length2];
                        System.arraycopy(a, leftIndex, leftArray, 0, length1);
                        System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
                        for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
                                if (i == length1) {
                                        a[k] = rightArray[j++];
                                } else if (j == length2) {
                                        a[k] = leftArray[i++];
                                } else {
                                        a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
                                }
                        }
                }
 
                private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
                        for (int i = leftIndex + 1; i <= rightIndex; i++) {
                                int current = a[i];
                                int j = i - 1;
                                while (j >= leftIndex && a[j] > current) {
                                        a[j + 1] = a[j];
                                        j--;
                                }
                                a[j + 1] = current;
                        }
                } 
        }
        
       
        
        boolean isPrime(int a){
        	for(int i = 2; i <= sqrt(a); i++)
        		if(a % i == 0) return false;
        	return true;
        }
        
        static double distance(long x1, long y1, long x2, long y2){
        	return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
        }
        
        static long gcd(long a, long b){
        	if(min(a,b) == 0) return max(a,b);
        	return gcd(max(a, b) % min(a,b), min(a,b));
        }
        
        static long lcm(long a, long b){
        	return a * b /gcd(a, b);
        }
}