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
import java.io.*;
import java.util.StringTokenizer;

public class Codeforces {
  public static void main(String[] args) {
    PrintWriter out = new PrintWriter(System.out);
    (new Solution()).solve(new InputReader(System.in), out);
    out.close();
  }

  private static class Solution {
    void solve(InputReader in, PrintWriter out) {
      String cell = in.nextLine();
      char row = cell.charAt(1);
      char col = cell.charAt(0);
      int type = 0;
      if (col == 'a' || col == 'h') {
        type++;
      }
      if (row == '1' || row == '8') {
        type++;
      }
      if (type == 0) {
        out.println(8);
      } else if (type == 1) {
        out.println(5);
      } else {
        out.println(3);
      }
    }
  }

  private static class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
    }

    String next() {
      while (tokenizer == null || !tokenizer.hasMoreElements()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = null;
      try {
        str = reader.readLine();
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
      return str;
    }
  }
}