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
//package competitive.akohlikashish.com.competitiveprogramming.Important_module;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

/**
 * Created by akohlikashish on 28/03/16.
 */
public final class Main {
    public static void main(String[] args) {
        HashMap map = new HashMap<Character,Integer>();
        map.put('a',1);
        map.put('b',2);
        map.put('c',3);
        map.put('d',4);
        map.put('e',5);
        map.put('f',6);
        map.put('g',7);
        map.put('h',8);
        FastIO io = new FastIO();
        String s = io.read();
        int x = (int) map.get(s.charAt(0));
        int y = s.charAt(1)-'0';
        long answer = 0;
        answer+=method(x-1,y);
        answer+=method(x+1,y);
        answer+=method(x,y-1);
        answer+=method(x,y+1);
        answer+=method(x-1,y-1);
        answer+=method(x-1,y+1);
        answer+=method(x+1,y+1);
        answer+=method(x+1,y-1);

        System.out.println(answer);
    }

    static int method(int x,int y){
        int count = 0;
        if (x>=1 && x<=8 && y>=1 && y<=8){
            return 1;
        }else{
            return 0;
        }
    }

    static class FastIO {
        static BufferedInputStream in = new BufferedInputStream(System.in);

        static int readInt() {
            int no = 0;
            boolean minus = false;
            try {
                int a = in.read();
                while (a == 32 || a == 10) //10 is newline & 32 is ASCII for space
                    a = in.read();
                if (a == '-') {
                    minus = true;
                    a = in.read();
                }
                while (a != 10 && a != 32 && a != -1) {
                    no = no * 10 + (a - '0');
                    a = in.read();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            return minus ? -no : no;
        }

        static String read() {
            StringBuilder str = new StringBuilder();
            try {
                int a = in.read();
                while (a == 32)
                    a = in.read();
                while (a != 10 && a != 32 && a != -1) {
                    str.append((char) a);
                    a = in.read();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return str.toString();
        }
    }
}
 