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.PrintWriter;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Algotic {
	public static void f679_a() {
		Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    
	    int [] arr = {
	    		2,3,5,7,11,13,17,19,23,29,31,37,41,43,47
	    };
	    int um = 0;
	    
	    int [] arr2 = {
	    		4,9,25,49
	    };
	    
	    outerloop:
	    for(int i=0; i<arr.length; i++) {
	    	System.out.println(arr[i]);
	    	System.out.flush();
	    	if(sc.next().equals("yes")) {
	    		um++;
	    		if(um>=2) {
	    			out.println("composite");
	    			break;
	    		} else {
//	    			if(Arrays.asList(arg0))
	    			for(int j=0; j<arr2.length; j++) {
	    		    	System.out.println(arr2[j]);
	    		    	System.out.flush();
	    		    	if(sc.next().equals("yes")) {
	    		    		
	    		    			out.println("composite");
	    		    			um = 298;
	    		    			break outerloop;
	    		    		
	    		    	}
	    		    }
	    		}
	    	}
	    }
	    if(um < 2)
			out.println("prime");
	    
	    out.close();
	    sc.close();
	}
	
	public static void f702_a() {
		Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    
	   int n = sc.nextInt();
	   long l1 = 0;
	   long l2 = 0;
	   int counter = 0;
	   int maxCounter = 0;
	   for(int i=0; i<n; i++) {
		   l2 = sc.nextInt();
		   if(l2 > l1) {
			   counter++;
			   if(counter > maxCounter)
				   maxCounter=counter;
			   
		   } else {
			   counter = 1;
		   }
		   l1 = l2;
	   }
	    out.println(maxCounter);
	    out.close();
	    sc.close();
	}
	
	public static void f702_b() {
		Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    
	    ArrayList<Double> stepens2 = new ArrayList<Double>();
	    long res=0;
	   int n = sc.nextInt();
	   double [] numbers = new double[n];
	   for(long i=0; i<n; i++) {
		   numbers[(int) i] = sc.nextInt();
	   }
	   long lastStepen = 0;
	    for(long i=0; i<n; i++) {
	    	for1:  for(long j=i+1; j<n; j++) {
			   double key = numbers[(int) i] + numbers[(int) j];
			   if(stepens2.contains(key))
				   res++;
			   else  {
				   for2 : while(true) {
					   double res2;
					   res2 = key;
					   if((res2 % 2) != 0) {
						   if((res2 / 2) != 0) {
							   // ne 1 deyil nedeki cut
							   
						   }
					   }
					   res2 = res / 2;
					   lastStepen++;
					   double kk = Math.pow(2, lastStepen);
					   stepens2.add(kk);
					   if(kk == key) {
						   res++;
						   continue for1;
					   } else if(kk>key) {
						   break for2;
					   }
				   }
			   }
		   }
	   }
	    out.println(res);
	    out.close();
	    sc.close();
	}
	
	public static void main(String [] args) {
		f710_a();
	}
	
	public static void f710_a() {
		Scanner sc = new Scanner(System.in);
	    PrintWriter out = new PrintWriter(System.out);
	    
	   String n = sc.nextLine();
	   n = n.trim();
	   int res = 8;
	   if(n.substring(0,1).equals("a") || n.substring(0,1).equals("h") ) {
		   if(n.substring(1, 2).equals("1") || n.substring(1, 2).equals("8"))
			res = 3;
		   else res = 5;
	   } else if(n.substring(1, 2).equals("1") || n.substring(1, 2).equals("8")) {
		   res = 5;
	   }
	   else res = 8;
	   out.println(res+"");
	    out.close();
	    sc.close();
	}
}
