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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            final String input = in.nextLine();
            final Character col = input.charAt(0);
            final Character row = input.charAt(1);

            for (int i = 0; i < testNumber; i++) {
                if (isCorner(col, row)) {
                    out.println(3);
                    return;
                }

                if (isSide(col, row)) {
                    out.println(5);
                    return;
                }

                out.println(8);
            }
        }

        private boolean isSide(Character col, Character row) {
            return ('a' == col && (row.compareTo('1') > 0) && (row.compareTo('8') < 0)) ||
                    ('h' == col && (row.compareTo('1') > 0) && (row.compareTo('8') < 0)) ||
                    ('1' == row && (col.compareTo('a') > 0) && (col.compareTo('h') < 0)) ||
                    ('8' == row && (col.compareTo('a') > 0) && (col.compareTo('h') < 0));
        }

        private boolean isCorner(Character col, Character row) {
            return ('a' == col && row == '1') ||
                    ('h' == col && row == '1') ||
                    ('h' == col && row == '8') ||
                    ('a' == col && row == '8');
        }

    }
}

