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.Arrays;

public class _038B {

    static PrintWriter out = new PrintWriter(System.out);
    static Scan in = new Scan();

    public static void main(String[] args) throws IOException {
        int grid[][] = new int[8][8];
        char[] rook = in.nextArr();
        char[] knight = in.nextArr();
        int[] dx = {-1, -2, -2, -1, 1, 2, 2, 1};
        int[] dy = {-2, -1, 1, 2, 2, 1, -1, -2};
        int y = rook[0] - 'a';
        int x = rook[1] - '0' - 1;
        x = 7-x;
        for (int i = 0; i < 8; i++) {
            grid[i][y] = 1;
            grid[x][i] = 1;
        }
        for (int i = 0; i < 8; i++) {
            int X = dx[i] + x;
            int Y = dy[i] + y;
            if (X >= 0 && Y >= 0 && X < 8 && Y < 8)
                grid[X][Y] = 1;
        }

        y = knight[0] - 'a';
        x = knight[1] - '0' - 1;
        x = 7 - x;
        grid[x][y] = 1;


        for (int i = 0; i < 8; i++) {
            int X = dx[i] + x;
            int Y = dy[i] + y;
            if (X >= 0 && Y >= 0 && X < 8 && Y < 8)
                grid[X][Y] = 1;
        }
        int ways = 64;
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                if (grid[i][j] == 1) ways--;
            }
        }
        /*for (int[] is : grid) {
            System.out.println(Arrays.toString(is));
        }*/
        out.println(ways);
        
        out.flush();
    }
}
class Scan {

    private final java.io.InputStream stream = System.in;
    private final byte EOF = -1, NL = '\n', D = '-', SPC = ' ', buffer[] = new byte[0xFFFF];
    private char cBuff[] = new char[0xFF];
    public int $index, $readCount, itr;

    private void inc() { cBuff = java.util.Arrays.copyOf(cBuff, cBuff.length << 1); }
    
    private boolean readLINE() throws IOException {
        if ($readCount == EOF) return false;
        for (itr = 0;;) {
            while ($index < $readCount)
                if (buffer[$index] != NL) {
                    if (itr == cBuff.length) inc();
                    cBuff[itr++] = (char)buffer[$index++];
                } else {
                    $index++;
                    return true;
                }
            $index = 0; $readCount = stream.read(buffer);
            if ($readCount == EOF) return true;
        }
    }
    
    private boolean readPRT() throws IOException {
        if ($readCount == EOF) return false;
        T: for (;;) {
            while ($index < $readCount)
                if (buffer[$index] > SPC) break T;
                else $index++;
            $index = 0; $readCount = stream.read(buffer);
            if ($readCount == EOF) return false;
        }
        for (itr = 0;;) {
            while ($index < $readCount)
                if (buffer[$index] > SPC) {
                    if (itr == cBuff.length) inc();
                    cBuff[itr++] = (char)buffer[$index++];
                } else return true;
            $index = 0; $readCount = stream.read(buffer);
            if ($readCount == EOF) return true;
        }
    }

    public int nextInt() throws IOException {
        if (!readPRT())
            throw new IOException();
        else {
            int v = 0, i = 0; boolean neg;
            if (cBuff[i] == D) {neg = true; i++;} else neg = false;
            while (i < itr) v = (v << 3) + (v << 1) + cBuff[i++] - '0';
            return neg ? -v : v;
        }
    }

    public long nextLong() throws IOException {
        if (!readPRT())
            throw new IOException();
        else {
            long v = 0; int i = 0; boolean neg;
            if (cBuff[i] == D) {neg = true; i++;} else neg = false;
            while (i < itr) v = (v << 3L) + (v << 1L) + cBuff[i++] - '0';
            return neg ? -v : v;
        }
    }

    public char[] buffer() throws IOException
    { return readPRT() ? cBuff : null; }

    public String next() throws IOException
    { return readPRT() ? new String(cBuff, 0, itr) : null; }

    public char[] nextArr() throws IOException
    { return readPRT() ? java.util.Arrays.copyOf(cBuff, itr) : null; }

    public String nextLine() throws IOException
    { return readLINE() ? new String(cBuff, 0, itr) : null; }

    public char[] nextLineArr() throws IOException
    { return readLINE() ? java.util.Arrays.copyOf(cBuff, itr) : null; }

    public float nextFloat() throws IOException
    { return Float.parseFloat(next()); }

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