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
"""
King Moves
"""


# map_col = {'a':1, 'b':2, 'c':3, }

def num_move(x, y):
    x -= 1
    y = ord(y) - ord('a')
    c = 0
    if 0 < x < 7:
        c += 1
    if 0 < y < 7:
        c += 1
    if c == 0:
        return 3
    if c == 1:
        return 5
    return 8


if __name__ == '__main__':
    s = raw_input()
    print num_move(int(s[1]), s[0])