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

public class Main {

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

    static class TaskA {

        public void solve(int testNumber, InputReader input, PrintWriter out) {
            String s = input.next();
            HashMap <Character,Integer > hm = new HashMap() ;
            char[] alpha = {'a','b','c','d','e','f','g','h'};
            for (int i = 1; i < alpha.length+1; i++) {
                hm.put(alpha[i-1], i);
            }
            
            int row = 9-Integer.parseInt(s.charAt(1)+"");
            int colom = hm.get(s.charAt(0));
            
            if (row == 1 || row == 8) {
                if (colom == 1 || colom == 8) {
                    out.println(3);
                    return;
                }else{
                    out.println(5);
                    return;
                }
            }
            
            if (colom == 1 || colom == 8) {
                if (row == 1 || row == 8) {
                    out.println(3);
                    return;
                }else{
                    out.println(5);
                    return;
                }
            }
            
            out.println(8);
            
        }
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

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

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

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

    }
}
