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.math.*;
import java.util.*;
import java.util.concurrent.*;

public class P38B {

  final static int [][] HORSE_MOVES = {{-2, -1}, {-1, -2}, { 1, -2}, { 2, -1},
                                       { 2,  1}, { 1,  2}, {-1,  2}, {-2,  1}};

  boolean inField(int x, int y) {
    return ((x >= 0) && (x < 8) && (y >= 0) && (y < 8));
  }

  @SuppressWarnings("unchecked")
  public void run() throws Exception {
    String sxy = next();
    int rx = sxy.charAt(0) - 'a';
    int ry = sxy.charAt(1) - '1';
    sxy = next();
    int hx = sxy.charAt(0) - 'a';
    int hy = sxy.charAt(1) - '1';

    boolean [][] used = new boolean [8][8];
    used[rx][ry] = used[hx][hy] = true;
    for (int i = 0; i < 8; i++) {
      int x, y;
      x = rx - i; y = ry; if (inField(x, y)) used[x][y] = true;
      x = rx + i; y = ry; if (inField(x, y)) used[x][y] = true;
      x = rx; y = ry - i; if (inField(x, y)) used[x][y] = true;
      x = rx; y = ry + i; if (inField(x, y)) used[x][y] = true;
      x = hx + HORSE_MOVES[i][0]; y = hy + HORSE_MOVES[i][1]; if (inField(x, y)) used[x][y] = true;
    }

    int count = 0;
    for (int x = 0; x < 8; x++) {
lab:  for (int y = 0; y < 8; y++) {
        if (!used[x][y]) {
          for (int [] dxy : HORSE_MOVES) {
            if (((x + dxy[0]) == rx) && ((y + dxy[1]) == ry)) {
              continue lab;
            }
          }
          count++;
        }
      }
    }

    println(count);
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P38B().run();
    br.close();
    pw.close();
  }

  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

  String nextToken() throws IOException {
    while (stok == null || !stok.hasMoreTokens()) {
      String s = br.readLine();
      if (s == null) { return null; }
      stok = new StringTokenizer(s);
    }
    return stok.nextToken();
  }

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }
}