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
from functools import lru_cache, wraps
from sys import stderr

import time

INF = 10 ** 18 + 3
EPS = 1e-10


def main():
    c, r = input()
    c = ord(c) - ord('a') + 1
    r = int(r)
    print(fields_of_king(c, r, 8))


def fields_of_king(x, y, n):
    number_of_moves = 8
    moves = ((1, 0), (1, -1),
             (0, -1), (-1, -1),
             (-1, 0), (-1, 1),
             (0, 1), (1, 1))
    for move in moves:
        new_x, new_y = move
        new_x, new_y = x + new_x, y + new_y
        if new_x not in range(1, n + 1) or new_y not in range(1, n + 1):
            number_of_moves -= 1
    return number_of_moves


@lru_cache(10 ** 9)
def find_perm(length, n_different):
    if length == 0:
        return []

    if n_different != length - 1:
        return (list(range_of_len(length, length - n_different - 1, - 1))
                + find_perm(n_different + 1, n_different))

    curr = length
    go_down = True
    res = []
    for _ in range(n_different + 1):
        res.append(curr)
        curr = length - curr + go_down
        go_down ^= True

    return res


# Decorators
def res_to_stderr(function):
    def wrapped(*args, **kwargs):
        res = function(*args, **kwargs)
        print(res, file=stderr)
        return res

    return wrapped


def time_it(function, output=stderr):
    def wrapped(*args, **kwargs):
        start = time.time()
        res = function(*args, **kwargs)
        elapsed_time = time.time() - start
        print('Function "%s" took %f ms' % (function.__name__, elapsed_time * 1000),
              file=output)
        return res

    return wrapped


# Auxiliary functions
@res_to_stderr
def range_of_len(start, length, step=1):
    return range(start, start + length * step, step)


def set_input(file):
    global input
    input = lambda: file.readline().strip()


def set_output(file):
    global print
    l_print = print

    def print(*args, **kwargs):
        kwargs["file"] = kwargs.get("file", file)
        return l_print(*args, **kwargs)


if __name__ == '__main__':
    # set_input(open("", "r"))
    # set_output(open("", "w"))
    time_it(main)()
