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.*;

/**
 * @author Alexander Tsupko (alexander.tsupko@outlook.com)
 *         Copyright (c) All rights reserved.
 */
public class A {
    private static class Solve {
        // instance variables

        private void solve(InputReader in, OutputWriter out) {
            String string = in.next();
            if ((string.charAt(0) == 'a' || string.charAt(0) == 'h') &&
                (string.charAt(1) == '1' || string.charAt(1) == '8')) {
                out.println(3);
            } else
            if ((string.charAt(0) == 'a' || string.charAt(0) == 'h') &&
                (string.charAt(1) != '1' || string.charAt(1) != '8')) {
                out.println(5);
            } else
            if ((string.charAt(0) != 'a' || string.charAt(0) != 'h') &&
                (string.charAt(1) == '1' || string.charAt(1) == '8')) {
                out.println(5);
            } else out.println(8);
        }

        // instance methods
    }

    // static classes

    private static class InputReader {
        private BufferedReader bufferedReader;
        private StringTokenizer stringTokenizer;

        private InputReader(InputStream inputStream) {
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream), 32768);
        }

        private void close() throws IOException {
            bufferedReader.close();
        }

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

        private byte nextByte() {
            return Byte.parseByte(next());
        }

        private short nextShort() {
            return Short.parseShort(next());
        }

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

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

        private float nextFloat() {
            return Float.parseFloat(next());
        }

        private double nextDouble() {
            return Double.parseDouble(next());
        }

        private boolean nextBoolean() {
            return Boolean.parseBoolean(next());
        }
    }

    private static class OutputWriter {
        private final PrintWriter printWriter;

        private OutputWriter(OutputStream outputStream) {
            printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)), true);
        }

        private void close() {
            printWriter.close();
        }

        private void print(Object... objects) {
            int n = objects.length;
            for (int i = 0; i < n; i++) {
                if (i != 0) {
                    printWriter.print(' ');
                }
                printWriter.print(objects[i]);
            }
        }

        private void println(Object... objects) {
            print(objects);
            printWriter.println();
        }
    }

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Solve solve = new Solve();
        solve.solve(in, out);
        in.close();
        out.close();
    }
}
