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.*;
import static java.lang.Math.*;

public class BetaRound38_B implements Runnable {

	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	
	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok = new StringTokenizer("");

	void init() throws IOException {
		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	@Override
	public void run() {
		try {
			long t1 = System.currentTimeMillis();
			init();
			solve();
			out.close();
			long t2 = System.currentTimeMillis();
			System.err.println("Time = " + (t2 - t1));
		} catch (Exception e) {
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}

	public static void main(String[] args) {
		new Thread(new BetaRound38_B()).start();
	}

	final int[] ndx = {2, 2, 1, 1, -1, -1, -2, -2};
	final int[] ndy = {-1, 1, -2, 2, -2, 2, -1, 1};
	
	void solve() throws IOException {
		boolean[][] b = new boolean[8][8];
		String R = readString();
		int rx = R.charAt(0) - 'a';
		int ry = R.charAt(1) - '1';
		for (int i = 0; i < 8; i++) {
			b[rx][i] = true;
			b[i][ry] = true;
		}
		String N = readString();
		int nx = N.charAt(0) - 'a';
		int ny = N.charAt(1) - '1';
		b[nx][ny] = true;
		for (int k = 0; k < 8; k++) {
			if (valid(nx + ndx[k], ny + ndy[k])) {
				b[nx + ndx[k]][ny + ndy[k]] = true;
			}
		}
		int ans = 0;
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				if (!b[i][j]) {
					boolean ok = true;
					for (int k = 0; k < 8; k++) {
						if ((i + ndx[k] == rx && j + ndy[k] == ry) ||
							(i + ndx[k] == nx && j + ndy[k] == ny)) {
							ok = false;
							break;
						}
					}
					if (ok) ans++;
				}
			}
		}
		out.print(ans);
	}
	
	boolean valid(int x, int y) {
		return x >= 0 && x < 8 && y >= 0 && y < 8;
	}

}
