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.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Random;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Q4 {
	 public static LinkedList<Integer> adj[];
	 static int n;
	 public static void main(String[] args) {
		 InputReader  s=new InputReader(System.in);
		 PrintWriter o=new PrintWriter(System.out);
		 String s1=s.next();
		 if(s1.charAt(0)=='a'&& s1.charAt(1)=='1'){
			 o.println(3);
		 }
		 else if(s1.charAt(0)=='h'&& s1.charAt(1)=='1'){
			 o.println(3);
		 }
		 else  if(s1.charAt(0)=='a'&& s1.charAt(1)=='8'){
			 o.println(3);
		 }
		 else if(s1.charAt(0)=='h'&& s1.charAt(1)=='8'){
			 o.println(3);
		 }
		 else if(s1.charAt(0)=='a'){
			 o.println(5);
		 }
		 else if(s1.charAt(0)=='h'){
			 o.println(5);
		 }
		 else if(s1.charAt(1)=='1'){
			 o.println(5);
		 }
		 else if(s1.charAt(1)=='8'){
			 o.println(5);
		 }
		 else o.println(8);
		 o.close();
	 }	
	
	  static class InputReader {

		    public BufferedReader reader;
		    public StringTokenizer tokenizer;
	 
		    public InputReader(InputStream inputstream) {
		      reader = new BufferedReader(new InputStreamReader(inputstream));
		      tokenizer = null;
		    }
		    
		    public String nextLine(){
		    	String fullLine=null;
		    	while (tokenizer == null || !tokenizer.hasMoreTokens()) {
		            try {
		              fullLine=reader.readLine();
		            } catch (IOException e) {
		              throw new RuntimeException(e);
		            }
		            return fullLine;
		          }
		          return fullLine;
		    }
			public String next() {
		      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
		        try {
		          tokenizer = new StringTokenizer(reader.readLine());
		        } catch (IOException e) {
		          throw new RuntimeException(e);
		        }
		      }
		      return tokenizer.nextToken();
		    }
			public long nextLong() {
			      return Long.parseLong(next());
			    }
		    public int nextInt() {
		      return Integer.parseInt(next());
		    }
		  }


	private static boolean isPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        if (num % 2 == 0) return false;
        for (int i = 3; i * i <= num; i += 2)
            if (num % i == 0) return false;
        return true;
}
	
}
