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.awt.Point;
import java.math.BigInteger;

public final class Main {
    BufferedReader br;
    StringTokenizer stk;

    public static void main(String[] args) throws Exception {
        new Thread(null, new Runnable() {
            @Override
            public void run() {
                try {
                    new Main().run();
                } catch(Exception | Error ex) {ex.printStackTrace();}
            }
        }, "solution", 1<<26).start();
    }
    
    {
        stk = null;
        br = new BufferedReader(new InputStreamReader(System.in));
    }
    
    void run() throws Exception {
        String s = nt();
        int[][] board = new int[8][8];
        int r = s.charAt(1) - '0' - 1, c = s.charAt(0) - 'a';
        int count = 0;
        try {int num = board[r-1][c]; count++;} catch(Exception ex) {}
        try {int num = board[r+1][c]; count++;} catch(Exception ex) {}
        try {int num = board[r][c-1]; count++;} catch(Exception ex) {}
        try {int num = board[r][c+1]; count++;} catch(Exception ex) {}
        try {int num = board[r-1][c-1]; count++;} catch(Exception ex) {}
        try {int num = board[r+1][c-1]; count++;} catch(Exception ex) {}
        try {int num = board[r-1][c+1]; count++;} catch(Exception ex) {}
        try {int num = board[r+1][c+1]; count++;} catch(Exception ex) {}
        pl(count);
    }
    
    //Reader & Writer
    String nextToken() throws Exception {
        if (stk == null || !stk.hasMoreTokens()) {
            stk = new StringTokenizer(br.readLine(), " ");
        }
        return stk.nextToken();
    }

    String nt() throws Exception {
        return nextToken();
    }

    String ns() throws Exception {
        return br.readLine();
    }

    int ni() throws Exception {
        return Integer.parseInt(nextToken());
    }

    long nl() throws Exception {
        return Long.parseLong(nextToken());
    }

    double nd() throws Exception {
        return Double.parseDouble(nextToken());
    }

    void p(Object o) {
        System.out.print(o);
    }

    void pl(Object o) {
        System.out.println(o);
    }
}