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.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;



public class Problem1 {


	public static void main(String[] args) {
		// TODO Auto-generated method stub
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		String pos = in.next();
		String[] cor = {"a1", "a8", "h8","h1"};
		
		for(int i =0; i < 4; ++i)
		{
			if(cor[i].equals(pos))
			{
				out.println(3);
				out.close();
				return;
			}
		}
		
		if(pos.charAt(0) == 'a' || pos.charAt(0) == 'h' || pos.charAt(1) == '1'|| pos.charAt(1) == '8')
		{
			out.println(5);
		}
		else
		{
			out.println(8);
		}
		
		out.close();

	}
	
	static class Beacon implements Comparable<Beacon>
	{
		int a;
		int b;
		
		public Beacon(int a, int b)
		{
			this.a = a;
			this.b = b;
		}
		@Override
		public int compareTo(Beacon o) {
			return this.a - o.a;
		}
		
	}
	

	
	static class InputReader {
	    public BufferedReader reader;
	    public StringTokenizer tokenizer;

	    public InputReader(InputStream stream) {
	        reader = new BufferedReader(new InputStreamReader(stream), 32768);
	        tokenizer = null;
	    }

	    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 int nextInt() {
	        return Integer.parseInt(next());
	    }
	    
	    public long nextLong()
	    {
	    	return Long.parseLong(next());
	    }

	}


}
