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
/**
 * Created by 1 on 16.07.15.
 */

import java.io.*;
import java.util.*;


public class CF1 {
    private MyScanner in;
    private PrintWriter out;

    /*
    *  Solution here
    */
    private CF1 solve() {
        String s = in.next();
        char x = s.charAt(0);
        char y = s.charAt(1);
        if (x == 'a' || x == 'h') {
            if (y == '8' || y == '1') {
                out.print(3);
            }
            else {
                out.print(5);
            }
        } else if  (y == '8' || y == '1') {
            out.print(5);
        }
        else {
            out.print(8);
        }
        return this;
    }

    private CF1 init() {

        try {
            in = new MyScanner(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } catch (FileNotFoundException e) {
            throw new RuntimeException();
        }
        return this;
    }

    private CF1 finish() {
        out.flush();
        return this;
    }

    public static void main(String[] args) {
        new CF1().init().solve().finish();
    }

    private static class MyScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;
        private boolean hasNextTokenFlag = true;

        MyScanner(final Reader input) throws FileNotFoundException {
            reader = new BufferedReader(input);
            ensureTokenizer();
        }

        MyScanner(final String filename) throws FileNotFoundException {
            this(new FileReader(filename));
        }

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

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

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

        public String nextLine() {
            if (!hasNextToken()) {
                throw new NoSuchElementException();
            }
            return tokenizer.nextToken("");
        }

        public String next() {
            if (!hasNextToken()) {
                throw new NoSuchElementException();
            }
            return tokenizer.nextToken();
        }

        public boolean hasNextToken() {
            ensureTokenizer();
            return hasNextTokenFlag;
        }

        private void ensureTokenizer() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                String buffer = getBuffer();
                if (buffer == null) {
                    tokenizer = null;
                    hasNextTokenFlag = false;
                    return;
                }
                tokenizer = new StringTokenizer(buffer);
            }
        }

        private String getBuffer() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }

    }
}