Problem E. Edge of the knight

Author:A. Usmanov   Time limit:1 sec
Input file:input.txt   Memory limit:256 Mb
Output file:output.txt  

Statement

In a chess, it is useful in some positions if two knight figures cover one another.

Sergey has already placed one knight on an empty chess board. Now he wants to know number of squares where he can place the second knight so that knights would cover each other.

Input file format

First line contains position of the first knight in a format of HW, where H — column (file), W — row (rank).

Output file format

Output a single integer — number of squares for the second knight.

Constraints

H ∈ (a, b, c, d, e, f, g, h)

1 ≤ W ≤ 8

Note on samples

Remember that a knight moves in a shape of letter L. Knight moves for 1 square in one direction (vertically or horizontally), and for 2 squares in another direction.

In the first sample the second knight can be placed on squares c1, g1, c3, g3, d4 and f4.

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
e2
6
2
f5
8

0.094s 0.015s 13