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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 *
 * @author PRAVEER SATYAM
 */
public class A {
    public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static StringTokenizer stz ;
    static void rarray(long[] arr) throws IOException{
        stz = new StringTokenizer(br.readLine());
        for(int i=0;i<arr.length;i++){
            arr[i]= rlln(stz.nextToken());
        }
    }
    static void rarray(String[] arr) throws IOException{
        stz = new StringTokenizer(br.readLine());
        for(int i=0;i<arr.length;i++){
            arr[i]= stz.nextToken();
        }
    }
    static String rln() throws IOException{
        return br.readLine();
    }
    static int riln() throws IOException{
        return Integer.parseInt(br.readLine());
    }
    static long rlln() throws IOException{
        return Long.parseLong(br.readLine());
    }
    static double rdln() throws IOException{
        return Double.parseDouble(br.readLine());
    }
    static int riln(String s) {
        return Integer.parseInt(s);
    }
    static long rlln(String s) throws IOException{
        return Long.parseLong(s);
    }
    static double rdln(String s) {    
        return Double.parseDouble(s);
    }
    private static void p(Object obj){
        System.out.print(obj);
    }
    private static void pln(Object x){
        System.out.println(x);
    }
    public static void main(String[] args) throws IOException {
        
        //stz = new StringTokenizer(br.readLine());
        String s = rln();
        int col = s.charAt(0)-97;
        int row = s.charAt(1)-49;
        //Spln(col+" "+row);
        if(row%7==0&&col%7==0){
            pln(3);
        }
        else if(row%7==0||col%7==0){
            pln(5);
        }
        else
            pln(8);
    }    
}