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.math.BigInteger;
import java.util.*;

public class Main {

    FastScanner in;
    PrintWriter out;

    public Main() throws IOException {
    }

    class FastScanner {
        BufferedReader reader;
        StringTokenizer tokenizer;

        FastScanner() throws IOException {
            reader = new BufferedReader(new InputStreamReader(System.in));
        }

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

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                String line = reader.readLine();
                if (line == null) {
                    throw new EOFException();
                }
                tokenizer = new StringTokenizer(line);
            }
            return tokenizer.nextToken();
        }

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

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


    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() throws IOException{
        in =new FastScanner();
        out = new PrintWriter(new OutputStreamWriter(System.out));
        solve();
        out.flush();
    }

    int n;

    void solve() throws IOException {
        String s=in.next();
        char a=s.charAt(0), b=s.charAt(1);
        int res=8;
        if ((a=='a'||a=='h')&&(b=='1'||b=='8')) res=3; else
        if ((a>='b'&&a<='g'&&(b=='1'||b=='8'))||(b>='2'&&b<='7'&&(a=='a'||a=='h'))) res=5;
        out.print(res);
    }

    int next(int current){
        return current==n-1?0:current+1;
    }

    int prev(int current){
        return current==0?n-1:current-1;
    }

}