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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pradyumn Agrawal coderbond007  PLEASE!! PLEASE!! HACK MY SOLUTION!!
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            char[] rook = in.nextCharacterArray(2);
            char[] knight = in.nextCharacterArray(2);
            boolean[][] map = new boolean[8][8];
            int rr = rook[1] - '1';
            int rc = rook[0] - 'a';
            for (int i = 0; i < 8; ++i) {
                map[rr][i] = map[i][rc] = true;
            }
            int kr = knight[1] - '1';
            int kc = knight[0] - 'a';
            map[kr][kc] = true;
            for (int i = 0; i < 8; ++i) {
                int r = kr + MiscUtils.DX_KNIGHT[i];
                int c = kc + MiscUtils.DY_KNIGHT[i];
                if (r >= 0 && r < 8 && c >= 0 && c < 8) {
                    map[r][c] = true;
                }
            }
            for (int i = 0; i < 8; ++i) {
                int r = rr + MiscUtils.DX_KNIGHT[i];
                int c = rc + MiscUtils.DY_KNIGHT[i];
                if (r >= 0 && r < 8 && c >= 0 && c < 8) {
                    map[r][c] = true;
                }
            }
            int count = 0;
            for (int i = 0; i < 8; ++i) {
                for (int j = 0; j < 8; ++j) {
                    count += !map[i][j] ? 1 : 0;
                }
            }
            out.println(count);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        private boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        private static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public char nextCharacter() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            return (char) c;
        }

        public char[] nextCharacterArray(int n) {
            char[] chars = new char[n];
            for (int i = 0; i < n; i++) {
                chars[i] = nextCharacter();
            }
            return chars;
        }

        private interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class MiscUtils {
        public static final int[] DX_KNIGHT = {2, 1, -1, -2, -2, -1, 1, 2};
        public static final int[] DY_KNIGHT = {1, 2, 2, 1, -1, -2, -2, -1};

    }
}

