The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king.

Check the king's moves here https://en.wikipedia.org/wiki/King_(chess).

<image> King moves from the position e4

Input

The only line contains the king's position in the format "cd", where 'c' is the column from 'a' to 'h' and 'd' is the row from '1' to '8'.

Output

Print the only integer x — the number of moves permitted for the king.

Example

Input

e4


Output

8
#include <bits/stdc++.h>
using namespace std;
bool comp(pair<long long, char> aa, pair<long long, char> bb) {
  if (aa.first != bb.first) return aa.first > bb.first;
  return aa.second < bb.second;
}
bool comp1(pair<long long, char> aa, pair<long long, char> bb) {
  if (aa.first != bb.first) return aa.first < bb.first;
  return aa.second > bb.second;
}
bool comp2(pair<long long, long long> aa, pair<long long, long long> bb) {
  if (aa.first != bb.first) return aa.first > bb.first;
  return aa.second < bb.second;
}
bool comp3(pair<long long, long long> aa, pair<long long, long long> bb) {
  if (aa.first != bb.first) return aa.first < bb.first;
  return aa.second > bb.second;
}
long long sumg(long long i) { return ((i * (i + 1))) + ((i * (i - 1)) / 2); }
bool yo(string str1, string str2, long long m, long long n) {
  if (m == 0) return true;
  if (n == 0) return false;
  if (str1[m - 1] == str2[n - 1]) return yo(str1, str2, m - 1, n - 1);
  return yo(str1, str2, m, n - 1);
}
long long rup(long long ik, long long ikk) {
  if (ik % ikk == 0)
    return ik / ikk;
  else
    return (ik / ikk) + 1;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
bool kop(long long n1) {
  long long i;
  long long n = n1;
  set<long long> s1;
  map<long long, long long> m;
  for (i = 2; i <= sqrt(n); i = i + 1) {
    while (n % i == 0) {
      s1.insert(i);
      m[i] += 1;
      if (m[i] == 2) return true;
      n /= i;
    }
  }
  if (n > 1) {
    s1.insert(n);
    m[n] += 1;
    if (m[n] == 2) return true;
  }
  return false;
}
long long ncr(long long n, long long r) {
  long long p = 1, k = 1;
  if (n - r < r) r = n - r;
  if (r != 0) {
    while (r) {
      p *= n;
      k *= r;
      long long m = gcd(p, k);
      p /= m;
      k /= m;
      n--;
      r--;
    }
  } else
    p = 1;
  return p;
}
long long modpow(long long x, long long n, long long m) {
  if (n == 0) return 1 % m;
  long long u = modpow(x, n / 2, m);
  u = (u * u) % m;
  if (n % 2 == 1) u = (u * x) % m;
  return u;
}
void interactive() {
  long long l = 1, r = 1000000;
  while (l != r) {
    long long mid = (l + r + 1) / 2;
    printf("%lld\n", mid);
    fflush(stdout);
    string response;
    cin >> response;
    if (response == "<")
      r = mid - 1;
    else
      l = mid;
  }
  printf("! %lld\n", l);
  fflush(stdout);
}
long long arr[200005] = {};
void bs(long long n, long long x) {
  long long a = 0, b = n - 1;
  while (a <= b) {
    long long k = (a + b) / 2;
    if (arr[k] == x) {
      cout << k + 1 << "\n";
      break;
    }
    if (arr[k] > x)
      b = k - 1;
    else
      a = k + 1;
  }
}
bool prime(long long jh) {
  long long j;
  long long g = 0;
  for (j = 2; j <= sqrt(jh); j = j + 1) {
    if (jh % j == 0) {
      g++;
      break;
    }
  }
  if (g == 1)
    return false;
  else
    return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1;
  while (t--) {
    string s;
    cin >> s;
    if ((s[0] == 'a' or s[0] == 'h') && (s[1] == '1' or s[1] == '8'))
      cout << 3 << "\n";
    else if (s[0] == 'a' or s[0] == 'h' or s[1] == '1' or s[1] == '8')
      cout << 5 << "\n";
    else
      cout << 8 << "\n";
  }
}
