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.*;
//import java.math.*;
//import static java.lang.Math.*;
//import static java.lang.Integer.parseInt;
//import static java.lang.Long.parseLong;
//import static java.lang.Double.parseDouble;
//import static java.lang.String.*;

public class Main {

    public static void main(String[] args) throws IOException {
//        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));                                    //(new FileReader("input.in"));
//        StringBuilder out = new StringBuilder();
//        StringTokenizer tk;
        //   Scanner s = new Scanner(System.in);
        Reader.init(System.in);
        //tk = new StringTokenizer(in.readLine());
        String x = Reader.next();
        if((x.charAt(0)=='h'&&x.charAt(1)=='1')||(x.charAt(0)=='a'&&x.charAt(1)=='1')||(x.charAt(0)=='h'&&x.charAt(1)=='8')||(x.charAt(0)=='a'&&x.charAt(1)=='8'))
            System.out.println(3);
        else if(x.charAt(0)=='a'||x.charAt(0)=='h'||x.charAt(1)=='1'||x.charAt(1)=='8')
            System.out.println(5);
        else System.out.println(8);
    }

}
class Reader {

    static StringTokenizer tokenizer;
    static BufferedReader reader;

    public static void init(InputStream input) throws UnsupportedEncodingException {
        reader = new BufferedReader(new InputStreamReader(input, "UTF-8"));
        tokenizer = new StringTokenizer("");
    }

    public static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    public static String nextLine() throws IOException {
        return reader.readLine();
    }

    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
}