#include <bits/stdc++.h>
using namespace std;
const int MAX = 112;
const int MAXN = 45010;
const int P = 1000000007;
const int INF = 100000000;
const double EPS = 1e-6;
const double PI = 3.14159265358979;
int main(void) {
  char pos[5];
  scanf("%s", pos);
  if (pos[0] == 'h' || pos[0] == 'a') {
    if (pos[1] == '8' || pos[1] == '1')
      printf("3\n");
    else
      printf("5\n");
  } else if (pos[1] == '8' || pos[1] == '1') {
    printf("5\n");
  } else
    printf("8\n");
  return 0;
}
