710_A. King Moves
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
```python
import sys
from collections import Counter
from math import factorial

input = sys.stdin
output = sys.stdout

# input = open('input.txt')


def read_int():
    return [int(x) for x in input.readline().rstrip().split()]

line = input.readline().rstrip()
x = ord(line[0]) - ord('a')
y = ord(line[1]) - ord('1')
answer = 0
for _x in range(x - 1, x + 2):
    for _y in range(y - 1, y + 2):
        if _x != x or _y != y:
            if 0 <= _x < 8 and 0 <= _y < 8:
                answer += 1

output.write('%d\n' % answer)

```