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

public class CodeForces {
    public static void main(String[] args) {
        FastIO io = FastIO.create();

        Coordinate r = toCoordinate(io.nextLine());
        Coordinate k = toCoordinate(io.nextLine());

        int count = 0;

        int[][] knightMoves = new int[][]{{-2, -1}, {-2, 1}, {-1, 2}, {1, 2}, {2, -1}, {2, 1}, {-1, -2}, {1, -2}};

        for (int row = 0; row < 8; row++) {
            next: for (int col = 0; col < 8; col++) {
                if (r.col == col || r.row == row || (k.col == col && k.row == row)) {
                    continue;
                }

                for (int[] move : knightMoves) {
                    if (k.col + move[0] == col && k.row + move[1] == row) {
                        continue next;
                    }
                    if (col + move[0] == r.col && row + move[1] == r.row) {
                        continue next;
                    }
                }

                count++;
            }
        }

        io.println(count);

        io.close();
    }

    static Coordinate toCoordinate(String s) {
        int col = s.charAt(0) - 'a';
        int row = s.charAt(1) - '1';

        return new Coordinate(row, col);
    }

    static class Coordinate {
        int col;
        int row;

        public Coordinate(int col, int row) {
            this.col = col;
            this.row = row;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Coordinate that = (Coordinate) o;
            return col == that.col &&
                    row == that.row;
        }

        @Override
        public int hashCode() {
            return Objects.hash(col, row);
        }
    }

    static class FastIO extends PrintWriter {
        BufferedReader br;
        StringTokenizer st;

        public FastIO(InputStream is, OutputStream os) {
            super(new BufferedOutputStream(os));
            br = new BufferedReader(new InputStreamReader(is));
        }

        public static FastIO create() {
            return new FastIO(System.in, System.out);
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return "";
        }
    }
}