Two chess pieces, a rook and a knight, stand on a standard chessboard 8 × 8 in size. The positions in which they are situated are known. It is guaranteed that none of them beats the other one.

Your task is to find the number of ways to place another knight on the board so that none of the three pieces on the board beat another one. A new piece can only be placed on an empty square.

Input

The first input line contains the description of the rook's position on the board. This description is a line which is 2 in length. Its first symbol is a lower-case Latin letter from a to h, and its second symbol is a number from 1 to 8. The second line contains the description of the knight's position in a similar way. It is guaranteed that their positions do not coincide.

Output

Print a single number which is the required number of ways.

Examples

Input

a1
b2


Output

44


Input

a8
d4


Output

38

import sys
import string

lines = sys.stdin.readlines()

rook = lines[0]
horse = lines[1]

letters = string.letters
key_letters = []
for letter in letters[:8]:
    key_letters.append(letter)

blocked_positions = []
def block_position(position):
    if position not in blocked_positions:
        blocked_positions.append(position)

def block_rook_hits(position):
    rook_block_vert = map(lambda x: "%s%d" % (position[0], x), range(1, 9)) 
    rook_block_horz = map(lambda x: "%s%d" % (key_letters[x], int(position[1])), range(0, 8)) 
    for pos in rook_block_vert:
        block_position(pos)
    for pos in rook_block_horz:
        block_position(pos)


def block_horse_hits(position):
    a, b = (key_letters.index(position[0]), int(position[1]))

    # up right
    if a - 2 > -1 and b + 1 < 9:
        block_position("%s%d" % (key_letters[a - 2], b + 1))
    # up left
    if a - 2 > -1 and b - 1 > 0:
        block_position("%s%d" % (key_letters[a - 2], b - 1))
    # down right
    if a + 2 < 8 and b + 1 < 9:
        block_position("%s%d" % (key_letters[a + 2], b + 1))
    # down left
    if a + 2 < 8 and b - 1 > 0:
        block_position("%s%d" % (key_letters[a + 2], b - 1))
    # left up 
    if a - 1 > -1 and b - 2 > 0:
        block_position("%s%d" % (key_letters[a - 1], b - 2))
    # left down 
    if a + 1 < 8 and b - 2 > 0:
        block_position("%s%d" % (key_letters[a + 1], b - 2))
    # right up 
    if a - 1 > -1 and b + 2 < 9:
        block_position("%s%d" % (key_letters[a - 1], b + 2))
    # right down 
    if a + 1 < 8 and b + 2 < 9:
        block_position("%s%d" % (key_letters[a + 1], b + 2))

block_position(horse)
block_rook_hits(rook)
block_horse_hits(horse)
block_horse_hits(rook)

print (8 * 8) - (len(blocked_positions)) 
