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.util.Scanner;

public class Chess {
	
	enum COLUMN{
		a,b,c,d,e,f,g,h
	};
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		String pos=s.nextLine();
		String col=pos.substring(0, 1);
		String row=pos.substring(1, 2);
		int count=0;
		String str="abcdefgh";
		if(Integer.parseInt(row)<1 || Integer.parseInt(row)>8){
			System.out.println(0);
			return;
		}
		if(!str.contains(col)){
			System.out.println(0);
			return;
		}
		if(Integer.parseInt(row)!=(COLUMN.a.ordinal()+1) && Integer.parseInt(row)!=(COLUMN.h.ordinal()+1)){
			if(!col.equals(COLUMN.a.toString()) && !col.equals(COLUMN.h.toString())){
				//Count should be incremented twice - one for up and one for down
				//4 times for Diagonal
				//Twice for Sideways
				count=count+8;
			}
			else{
				//Count should be incremented twice - one for up and one for down
				//2 times for Diagonal
				//1 for left/right
				count=count+5;
			}
		}
		else{
			if(!col.equals(COLUMN.a.toString()) && !col.equals(COLUMN.h.toString())){
				//Count should be incremented twice - one for right and one for left
				//2 times for Diagonals
				//1 for Up/Down
				count=count+5;
			}
			else{
				//These are the corner piece- Hence, 3 moves
				count=count+3;
			}
		}
		System.out.println(count);
	}

}