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.*;
import java.math.*;
import java.util.*;

/**
* 
* @author Togrul Gasimov (ttogrul30@gmail.com)
*         Created on 11.09.2013
*/

public class Main {
   public static void main(String[] args) /*throws FileNotFoundException*/ { 
       InputStream inputStream = System.in;
       OutputStream outputStream = System.out;
       FastScanner in = new FastScanner(inputStream);
       FastPrinter out = new FastPrinter(outputStream);
       TaskA solver = new TaskA();
       solver.solve(1, in, out);
       out.close();
   }
}

class TaskA{
   static int gcd(int m, int n){
	   if(m < n)return gcd(n, m);
	   else if(m % n == 0)return n;
	   else return gcd(n, m % n);
   }
   public void solve(int testNumber, FastScanner scan, FastPrinter out) /*throws FileNotFoundException*/ {
       //Scanner sscan = new Scanner(new File("input.txt"));
       //PrintStream oout = new PrintStream(new File("output.txt"));
	   String top = scan.next(), at = scan.next();
	   char[][] a = new char[8][8];
	   for(int i = 0; i <= 7; i++){
		   for(int j = 0; j<= 7; j++){
			   a[i][j] = '.';
		   }
	   }
	   int topi = top.charAt(1) - 49, topj = top.charAt(0) - 97;
	   int ati = at.charAt(1) - 49, atj = at.charAt(0) - 97;
	   int ans = 0; a[topi][topj] = 'T'; a[ati][atj] = 'A';
	   for(int i = 0; i <= 7; i++){
		   for(int j = 0; j <= 7; j++){
			   if(a[i][j] == 'T' || a[i][j] == 'A' )continue;
			   boolean p = false;
			   int x, y;
			   x = i; y = j;
			   while(true){
				   try{
					   x++;
					   if(a[x][y] == 'T'){
						    p = true; break;
					   }
				   }catch(Exception e){break;}
			   }
			   if(p)continue;
			   x = i; y = j;
			   while(true){
				   try{
					   x--;
					   if(a[x][y] == 'T'){
						   p = true; break;
					   }
				   }catch(Exception e){break;}
			   }
			   x = i; y = j; if(p)continue;
			   while(true){
				   try{
					   y++;
					   if(a[x][y] == 'T'){
						   p = true; break;
					   }
				   }catch(Exception e){break;}
			   }
			   x = i; y = j; if(p)continue;
			   while(true){
				   try{
					   y--;
					   if(a[x][y] == 'T'){
						   p = true; break;
					   }
				   }catch(Exception e){break;}
			   }
			   if(p)continue;
			   x = i; y = j;
			   try{
				   if(a[x + 1][y + 2] == 'T' || a[x + 1][y + 2] == 'A')continue; 
			   }catch(Exception e){}
			   try{
				   if(a[x + 1][y - 2] == 'T' || a[x + 1][y - 2] == 'A')continue; 
			   }catch(Exception e){}
			   try{
				   if(a[x - 1][y + 2] == 'T' || a[x - 1][y + 2] == 'A')continue; 
			   }catch(Exception e){}
			   try{
				   if(a[x - 1][y - 2] == 'T' || a[x - 1][y - 2] == 'A')continue; 
			   }catch(Exception e){}
			   try{
				   if(a[x + 2][y + 1] == 'T' || a[x + 2][y + 1] == 'A')continue; 
			   }catch(Exception e){}
			   try{
				   if(a[x + 2][y - 1] == 'T' || a[x + 2][y - 1] == 'A')continue; 
			   }catch(Exception e){}
			   try{
				   if(a[x - 2][y + 1] == 'T' || a[x - 2][y + 1] == 'A')continue; 
			   }catch(Exception e){}
			   try{
				   if(a[x - 2][y - 1] == 'T' || a[x - 2][y - 1] == 'A')continue; 
			   }catch(Exception e){}
			   a[i][j] = 'a';
			   ans++;
		   }
	   }
	   out.println(ans);
	   
       //sscan.close();
       //oout.close();
   }
}

class FastScanner extends BufferedReader {
   public FastScanner(InputStream is) {
       super(new InputStreamReader(is));
   }
   
   public int read() {
       try{
           int ret = super.read();
           return ret;
       }catch(Exception e){
           throw new InputMismatchException();
       }
   }
   
   public String next() {
       StringBuilder sb = new StringBuilder();
       int c = read();
       while (isWhiteSpace(c)) {
           c = read();
       }
       if (c < 0) {
           return null;
       }
       while (c >= 0 && !isWhiteSpace(c)) {
           sb.appendCodePoint(c);
           c = read();
       }
       return sb.toString();
   }
   
   static boolean isWhiteSpace(int c) {
       return c >= 0 && c <= 32;
   }
   
   public int nextInt() {
       int c = read();
       while (isWhiteSpace(c)) {
           c = read();
       }
       int sgn = 1;
       if (c == '-') {
           sgn = -1;
           c = read();
       }
       int ret = 0;
       while (c >= 0 && !isWhiteSpace(c)) {
           if (c < '0' || c > '9') {
               throw new NumberFormatException("digit expected " + (char) c
                       + " found");
           }
           ret = ret * 10 + c - '0';
           c = read();
       }
       return ret * sgn;
   }
   
   public long nextLong() {
       return Long.parseLong(next());
   }
   
   public double nextDouble() {
       return Double.parseDouble(next());
   }
   
   public BigInteger nextBigInteger() {
       return new BigInteger(next());
   }
   
   public BigDecimal nextBigDecimal(){
       return new BigDecimal(next());
   }
   
   public String readLine(){
       try{
           return super.readLine();
       }catch(IOException e){
           return null;
       }
   }
}

class FastPrinter extends PrintWriter {
   
   public FastPrinter(OutputStream out) {
       super(out);
   }
   public FastPrinter(Writer out) {
       super(out);
   }
}