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

//package pkg38b;

import java.util.Scanner;



public class task38b { 

    public static void main(String[] args) {
        Scanner scan = new Scanner (System.in);
        
        String lad = scan.nextLine();
        String kon = scan.nextLine();
        
        Shesterka ob = new Shesterka();
        ob.delete_ish(lad, kon);
        ob.delete_lad(lad);
        ob.delete_kon(ob.create_chod_kon(lad));
        ob.delete_kon(ob.create_chod_kon(kon));
        ob.otvet();
    }
    
}

class Shesterka  {
    
    String[][] free = new String[8][8];
    
    Shesterka () {
        for (int i = 0; i<8; i++) {
            for (int j = 0; j < 8; j++) {
                free[i][j]=""; 
                free[i][j]+=(char)(j+'a');     
                free[i][j]+=(char)(i+'1'); 
            }
        }       
    }//создание поля

    void delete_lad (String chod) {
        for (int i = 0; i < 8 ; i++) {
            free[i][chod.charAt(0)-'a'] = "0";
            free[chod.charAt(1)-'1'][i] = "0";
        }
    } //удалили бьющие поля ладьи
    
    StringBuffer[] create_chod_kon (String str) {
        StringBuffer mas[] = new StringBuffer[8];
        for (int i = 0; i < 8; i++) {
            mas[i] = new StringBuffer("");
        }
        mas[0].insert(0,(char)(str.charAt(0)+1));//БУКВА
        mas[0].insert(1,(char)(str.charAt(1)-2));//ЧИСЛО
        
        mas[1].insert(0,(char)(str.charAt(0)+2));
        mas[1].insert(1,(char)(str.charAt(1)-1));
        
        mas[2].insert(0,(char)(str.charAt(0)+2));
        mas[2].insert(1,(char)(str.charAt(1)+1));
        
        mas[3].insert(0,(char)(str.charAt(0)+1));
        mas[3].insert(1,(char)(str.charAt(1)+2));
        
        mas[4].insert(0,(char)(str.charAt(0)-1));
        mas[4].insert(1,(char)(str.charAt(1)+2));
        
        mas[5].insert(0,(char)(str.charAt(0)-2));
        mas[5].insert(1,(char)(str.charAt(1)+1));
        
        mas[6].insert(0,(char)(str.charAt(0)-2));
        mas[6].insert(1,(char)(str.charAt(1)-1));
        
        mas[7].insert(0,(char)(str.charAt(0)-1));
        mas[7].insert(1,(char)(str.charAt(1)-2));
        
        return mas;
    }//все возможные поля, с которых бьёт конь
    
    void delete_kon (StringBuffer mas[]) {
            for (int i = 0; i < 8; i++) {
                try {
                    free[mas[i].charAt(1)-'1'][mas[i].charAt(0)-'a'] = "0";
                } catch (Exception e) {
                    continue;
                }    
            }
    }//удалить все поля с котрых бьёт конь
    
    void delete_ish (String str, String str2) {
        free[str.charAt(1) - '1'][str.charAt(0) - 'a'] = "0";
        free[str2.charAt(1) - '1'][str2.charAt(0) - 'a'] = "0";
    }
   
    void otvet () {
        int count = 0;
        for (int i = 0; i < 8 ;i++ ) {
            for (int j = 0; j < 8; j++) {
                if (!(free[i][j].equals("0"))) {
                    count++;
                }
            }
        }
        System.out.println (count);
    }
    
}
