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
/**
 * Created by IntelliJ IDEA.
 * User: shakhov
 * Date: 15.06.2011
 * Time: 15:22:46
 * To change this template use File | Settings | File Templates.
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class CodeForces {

    public void solve() throws IOException {
        String rook = nextToken();
        String knight = nextToken();
        int arr[][] = new int[8][8];
        for (int i = 0; i < 8; i++) {
            Arrays.fill(arr[i], 1);
        }
        int rookx = rook.charAt(0) - 'a';
        int rooky = rook.charAt(1) - '1';
        int knightx = knight.charAt(0) - 'a';
        int knighty = knight.charAt(1) - '1';

        for (int i = 0; i < 8; i++) {
            arr[i][rookx] = 0;
            arr[rooky][i] = 0;
        }
        arr[knighty][knightx]=0;

        int step[][] = new int[8][2];
        step[0] = new int[]{-1, 2};
        step[1] = new int[]{1, 2};
        step[2] = new int[]{2, 1};
        step[3] = new int[]{2, -1};
        step[4] = new int[]{-1, -2};
        step[5] = new int[]{1, -2};
        step[6] = new int[]{-2, -1};
        step[7] = new int[]{-2, 1};
        for (int i = 0; i < 8; i++) {
            int nrx = rookx + step[i][0];
            int nry = rooky + step[i][1];
            if (nrx > -1 && nrx < 8 && nry > -1 && nry < 8) {
                arr[nry][nrx] = 0;
            }
            int nkx = knightx + step[i][0];
            int nky = knighty + step[i][1];
            if (nkx > -1 && nkx < 8 && nky > -1 && nky < 8) {
                arr[nky][nkx] = 0;
            }
        }

        int counter=0;
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                if(arr[i][j]==1) counter++;
            }
        }

        writer.print(counter);

    }


    public static void main(String[] args) {
        new CodeForces().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            //reader = new BufferedReader(new FileReader("LifeWithoutZeros.in"));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            //writer = new PrintWriter(new BufferedWriter(new FileWriter("LifeWithoutZeros.out")));
            //long t=new Date().getTime();
            solve();
            //writer.println(t-new Date().getTime());
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}
