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.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Set;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

import javax.print.DocFlavor.INPUT_STREAM;

import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;

import static java.lang.Double.*;
import static java.math.BigInteger.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main implements Runnable {

	private void solve() throws IOException {
		//long start = System.currentTimeMillis();
		init();
		readData();
		processing();
		//System.err.println(System.currentTimeMillis() - start);
	}
	
	private void init() {
	}
	
	private void processing() {
		int x = s1.charAt(0) - 'a';
		int y = s1.charAt(1) - '1';
		int x2 = s2.charAt(0) - 'a';
		int y2 = s2.charAt(1) - '1';
		boolean[][] table = new boolean[8][8];
		for (boolean[] a: table) {
			fill(a, true);
		}
		for (int i = 0; i < 8; ++i) {
			table[x][i] = false;
			table[i][y] = false;
		}
		table[x2][y2] = false;
		for (int i = 0; i < 8; ++i) {
			int nx = x2 + kx[i];
			int ny = y2 + ky[i];
			if (nx >= 0 && ny >= 0 && nx < 8 && ny < 8) {
				table[nx][ny] = false;
			}
		}
		for (int i = 0; i < 8; ++i) {
			int nx = x + kx[i];
			int ny = y + ky[i];
			if (nx >= 0 && ny >= 0 && nx < 8 && ny < 8) {
				table[nx][ny] = false;
			}
		}
		int answer = 0;
		for (int i = 0; i < 8; ++i) {
			for (int j = 0; j < 8; ++j) {
				if (table[i][j]) {
					++answer;
				}
			}
		}
		print(answer);
	}
	
	private void readData() throws IOException {
		s1 = nextToken();
		s2 = nextToken();
	}
	
	private String s1;
	private String s2;
	
	private final int[] kx = {-2, -2, -1, -1, 1, 1, 2, 2};
	private final int[] ky = {-1, 1, -2, 2, -2, 2, -1, 1};
	
	public static void main(String[] args) throws InterruptedException {
		new Thread(null, new Runnable() {
			public void run() {
				new Main().run();
			}
		}, "1", 1 << 24).start();
	}

	// @Override
	public void run() {
		try {
			boolean onlineJudge = System.getProperty("ONLINE_JUDGE") != null;
			reader = onlineJudge ? new BufferedReader(new InputStreamReader(
					System.in)) : new BufferedReader(
					new FileReader("input.txt"));
			writer = onlineJudge ? new PrintWriter(new BufferedWriter(
					new OutputStreamWriter(System.out))) : new PrintWriter(
					new BufferedWriter(new FileWriter("output.txt")));
			Locale.setDefault(Locale.US);
			tokenizer = null;
			solve();
			writer.flush();
		} catch (Exception error) {
			error.printStackTrace();
			System.exit(1);
		}
	}

	private BufferedReader reader;
	private PrintWriter writer;
	private StringTokenizer tokenizer;

	private void println() {
		writer.println();
	}

	private void print(Object obj) {
		writer.print(obj);
	}

	private void println(Object obj) {
		writer.println(obj);
	}

	private void printf(String f, Object... obj) {
		writer.printf(f, obj);
	}

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

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

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

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