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.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Scanner;
import java.util.function.Function;
import java.util.stream.Collectors;
public class _p000710A {
    static public void main(final String[] args) throws IOException {
        p000710A._main(args);
    }
//begin p000710A.java
static private class p000710A extends Solver{public p000710A(){nameIn="p000710A.in"
;singleTest=true;}String s;@Override protected void solve(){int ah=(int)(s.charAt
(0)-'a');int r=(int)(s.charAt(1)-'1');int res=0;if(ah>0){res++;}if(ah<7){res++;}
if(r>0){res++;}if(r<7){res++;}if(ah>0&&r>0){res++;}if(ah>0&&r<7){res++;}if(ah<7&&
r>0){res++;}if(ah<7&&r<7){res++;}pw.println(res);}@Override public void readInput
()throws IOException{s=sc.nextLine().trim();}static public void _main(String[]args
)throws IOException{new p000710A().run();}}
//end p000710A.java
//begin net/leksi/contest/Solver.java
static private abstract class Solver{protected String nameIn=null;protected String
nameOut=null;protected boolean singleTest=false;protected boolean preprocessDebug
=false;protected boolean doNotPreprocess=false;protected Scanner sc=null;protected
PrintWriter pw=null;private void process()throws IOException{if(!singleTest){int
t=lineToIntArray()[0];while(t-->0){readInput();solve();}}else{readInput();solve(
);}}abstract protected void readInput()throws IOException;abstract protected void
solve()throws IOException;protected int[]lineToIntArray()throws IOException{return
Arrays.stream(sc.nextLine().trim().split("\\s+")).mapToInt(Integer::valueOf).toArray
();}protected long[]lineToLongArray()throws IOException{return Arrays.stream(sc.nextLine
().trim().split("\\s+")).mapToLong(Long::valueOf).toArray();}protected String joinToString
(final int[]a){return Arrays.stream(a).mapToObj(Integer::toString).collect(Collectors
.joining(" "));}protected String joinToString(final long[]a){return Arrays.stream
(a).mapToObj(Long::toString).collect(Collectors.joining(" "));}protected<T>String
joinToString(final T[]a){return Arrays.stream(a).map(v->v.toString()).collect(Collectors
.joining(" "));}protected<T>String joinToString(final T[]a,final Function<T,String>
toString){return Arrays.stream(a).map(v->v.toString()).collect(Collectors.joining
(" "));}protected<T>String joinToString(final Collection<T>a){return a.stream().map
(v->v.toString()).collect(Collectors.joining(" "));}protected<T>String joinToString
(final Collection<T>a,final Function<T,String>toString){return a.stream().map(v->
toString.apply(v)).collect(Collectors.joining(" "));}protected List<Long>intArrayToLongList
(final int[]a){return Arrays.stream(a).mapToObj(Long::valueOf).collect(Collectors
.toList());}protected List<Integer>toList(final int[]a){return Arrays.stream(a).mapToObj
(Integer::valueOf).collect(Collectors.toList());}protected List<Long>toList(final
long[]a){return Arrays.stream(a).mapToObj(Long::valueOf).collect(Collectors.toList
());}protected void run()throws IOException{boolean done=false;if(nameIn !=null)
{try{try(FileInputStream fis=new FileInputStream(nameIn);PrintWriter pw0=select_output
();){done=true;sc=new Scanner(fis);pw=pw0;process();}}catch(IOException ex){}}if
(!done){try(PrintWriter pw0=select_output();){sc=new Scanner(System.in);pw=pw0;process
();}}}private PrintWriter select_output()throws FileNotFoundException{if(nameOut
!=null){return new PrintWriter(nameOut);}return new PrintWriter(System.out);}}
//end net/leksi/contest/Solver.java
}
