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


public class CF_710A {
	static FastScanner sc = new FastScanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);
	
	public static void main(String[] args) {
		new CF_710A().run();
		out.close();
	}
	
	public void run(){
		int col =  sc.read()-'a';
		int row = sc.read()-'1';
		if((col == 0 ||col == 7)&&(row == 0 || row == 7))
			out.println(3);
		else if((col == 0 ||col == 7)&&(row != 0 || row != 7))
			out.println(5);
		else if((col != 0 ||col != 7)&&(row == 0 || row == 7))
			out.println(5);
		else
			out.println(8);
	}

	static class FastScanner {
		private final InputStream stream;
	    private final byte[] buf = new byte[8192];
	    private int curChar, snumChars;

	    public FastScanner(InputStream st) {
	      this.stream = st;
	    }

	    //读一个字节
	    public int read() {
	      if (snumChars == -1)
	        throw new InputMismatchException();
	      if (curChar >= snumChars) {
	        curChar = 0;
	        try {
	          snumChars = stream.read(buf);
	        } catch (IOException e) {
	          throw new InputMismatchException();
	        }
	        if (snumChars <= 0)
	          return -1;
	      }
	      return buf[curChar++];
	    }
	}
}
