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
#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
long long power(long long a, long long b) {
  long long result = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      result *= a;
    }
    a *= a;
    b /= 2;
  }
  return result;
}
long long gcd(long long x, long long y) {
  long long r;
  while (y != 0 && (r = x % y) != 0) {
    x = y;
    y = r;
  }
  return y == 0 ? x : y;
}
long long countSetBits(long long x) {
  long long Count = 0;
  while (x > 0) {
    if (x & 1) Count++;
    x = x >> 1;
  }
  return Count;
}
bool isPerfectSquare(long long n) {
  long long sr = sqrt(n);
  if (sr * sr == n)
    return true;
  else
    return false;
}
long long mod(long long x) { return ((x % M + M) % M); }
long long add(long long a, long long b) { return mod(mod(a) + mod(b)); }
long long mul(long long a, long long b) { return mod(mod(a) * mod(b)); }
long long powerM(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b % 2 == 1) {
      res = mul(a, res);
    }
    a = mul(a, a);
    b /= 2;
  }
  return res;
}
vector<bool> sieve_of_eratothenes(long long n) {
  vector<bool> a(n + 1, 1);
  a[0] = 0;
  a[1] = 0;
  for (long long i = 2; i <= sqrt(n); i++) {
    if (a[i] == 1) {
      for (long long j = 2; i * j <= n; j++) {
        a[j * i] = 0;
      }
    }
  }
  return a;
}
long long modInverse(long long n) { return powerM(n, M - 2); }
long long nCrM(long long n, long long r) {
  if (n < r) return 0;
  if (r == 0) return 1;
  vector<long long> fact(n + 1);
  fact[0] = 1;
  for (long long i = 1; i <= n; i++) {
    fact[i] = mul(fact[i - 1], i);
  }
  return mul(mul(fact[n], modInverse(fact[r])), modInverse(fact[n - r]));
}
bool ok(long long a) {
  if (a / 10 <= 8 && a % 10 <= 8 && a / 10 >= 1 && a % 10 >= 1) {
    return 1;
  } else
    return 0;
}
void solve() {
  string s, t;
  cin >> s >> t;
  set<long long> mar_jaayega_yahan;
  long long rook = 10 * (s[0] - 'a' + 1) + (s[1] - '0');
  long long a = rook % 10;
  long long b = rook / 10;
  long long knight1 = 10 * (t[0] - 'a' + 1) + t[1] - '0';
  long long c = knight1 % 10;
  long long d = knight1 / 10;
  for (long long i = 1; i <= 8; i++) {
    mar_jaayega_yahan.insert(10 * b + i);
    mar_jaayega_yahan.insert(10 * i + a);
  }
  mar_jaayega_yahan.insert(10 * d + c);
  if (ok((d + 2) * 10 + c + 1)) mar_jaayega_yahan.insert((d + 2) * 10 + c + 1);
  if (ok((d + 2) * 10 + c - 1)) mar_jaayega_yahan.insert((d + 2) * 10 + c - 1);
  if (ok((d - 2) * 10 + c + 1)) mar_jaayega_yahan.insert((d - 2) * 10 + c + 1);
  if (ok((d - 2) * 10 + c - 1)) mar_jaayega_yahan.insert((d - 2) * 10 + c - 1);
  if (ok((d + 1) * 10 + c + 2)) mar_jaayega_yahan.insert((d + 1) * 10 + c + 2);
  if (ok((d + 1) * 10 + c - 2)) mar_jaayega_yahan.insert((d + 1) * 10 + c - 2);
  if (ok((d - 1) * 10 + c + 2)) mar_jaayega_yahan.insert((d - 1) * 10 + c + 2);
  if (ok((d - 1) * 10 + c - 2)) mar_jaayega_yahan.insert((d - 1) * 10 + c - 2);
  d = b;
  c = a;
  if (ok((d + 2) * 10 + c + 1)) mar_jaayega_yahan.insert((d + 2) * 10 + c + 1);
  if (ok((d + 2) * 10 + c - 1)) mar_jaayega_yahan.insert((d + 2) * 10 + c - 1);
  if (ok((d - 2) * 10 + c + 1)) mar_jaayega_yahan.insert((d - 2) * 10 + c + 1);
  if (ok((d - 2) * 10 + c - 1)) mar_jaayega_yahan.insert((d - 2) * 10 + c - 1);
  if (ok((d + 1) * 10 + c + 2)) mar_jaayega_yahan.insert((d + 1) * 10 + c + 2);
  if (ok((d + 1) * 10 + c - 2)) mar_jaayega_yahan.insert((d + 1) * 10 + c - 2);
  if (ok((d - 1) * 10 + c + 2)) mar_jaayega_yahan.insert((d - 1) * 10 + c + 2);
  if (ok((d - 1) * 10 + c - 2)) mar_jaayega_yahan.insert((d - 1) * 10 + c - 2);
  cout << 64 - mar_jaayega_yahan.size() << endl;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  solve();
  return 0;
}
