Author: | A. Usmanov | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 256 Mb | |
Output file: | output.txt |
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.
First line contains position of the first knight in a format of HW, where H — column (file), W — row (rank).
Output a single integer — number of squares for the second knight.
H ∈ (a, b, c, d, e, f, g, h)
1 ≤ W ≤ 8
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 c 1, g 1, c 3, g 3, d 4 and f 4.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|