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
a=input()
b=input()
c='abcdefgh'
d=c.find(a[0])+1
e=int(a[1])
f=c.find(b[0])+1
g=int(b[1])
a=[[0 for i in range(8)] for i in range(8)]
a[d-1]=[1 for i in range(8)]
for i in range(8):
    a[i][e-1]=1
a[d-1][e-1]=1
a[f-1][g-1]=1
if d>2:
    if d<7:
        if e>2:
            if e<7:
                a[d-1+2][e-1+1]=1
                a[d-1+2][e-1-1]=1
                a[d-1+1][e-1+2]=1
                a[d-1+1][e-1-2]=1
                a[d-1-1][e-1+2]=1
                a[d-1-1][e-1-2]=1
                a[d-1-2][e-1+1]=1
                a[d-1-2][e-1-1]=1
            elif e<8:
                a[d-1+2][e-1+1]=1
                a[d-1+2][e-1-1]=1
                a[d-1+1][e-1-2]=1
                a[d-1-1][e-1-2]=1
                a[d-1-2][e-1+1]=1
                a[d-1-2][e-1-1]=1
            else:
                a[d-1+2][e-1-1]=1
                a[d-1+1][e-1-2]=1
                a[d-1-1][e-1-2]=1
                a[d-1-2][e-1-1]=1
        elif e>1:
            a[d-1+2][e-1+1]=1
            a[d-1+2][e-1-1]=1
            a[d-1+1][e-1+2]=1
            a[d-1-1][e-1+2]=1
            a[d-1-2][e-1+1]=1
            a[d-1-2][e-1-1]=1
        else:
            a[d-1+2][e-1+1]=1
            a[d-1+1][e-1+2]=1
            a[d-1-1][e-1+2]=1
            a[d-1-2][e-1+1]=1
    elif d<8:
        if e>2:
            if e<7:
                a[d-1-2][e-1+1]=1
                a[d-1-2][e-1-1]=1
                a[d-1-1][e-1+2]=1
                a[d-1-1][e-1-2]=1
                a[d-1+1][e-1+2]=1
                a[d-1+1][e-1-2]=1
            elif e<8:
                a[d-1-2][e-1+1]=1
                a[d-1-2][e-1-1]=1
                a[d-1-1][e-1-2]=1
                a[d-1+1][e-1-2]=1
            else:
                a[d-1-2][e-1-1]=1
                a[d-1-1][e-1-2]=1
                a[d-1+1][e-1-2]=1
        elif e>1:
            a[d-1-2][e-1+1]=1
            a[d-1-2][e-1-1]=1
            a[d-1-1][e-1+2]=1
            a[d-1+1][e-1+2]=1
        else:
            a[d-1-2][e-1+1]=1
            a[d-1-1][e-1+2]=1
            a[d-1+1][e-1+2]=1
    else:
        if e>2:
            if e<7:
                a[d-1-2][e-1+1]=1
                a[d-1-2][e-1-1]=1
                a[d-1-1][e-1+2]=1
                a[d-1-1][e-1-2]=1
            elif e<8:
                a[d-1-2][e-1+1]=1
                a[d-1-2][e-1-1]=1
                a[d-1-1][e-1-2]=1
            else:
                a[d-1-2][e-1-1]=1
                a[d-1-1][e-1-2]=1
        elif e>1:
            a[d-1-2][e-1+1]=1
            a[d-1-2][e-1-1]=1
            a[d-1-1][e-1+2]=1
        else:
            a[d-1-2][e-1+1]=1
            a[d-1-1][e-1+2]=1
elif d>1:
    if e>2:
        if e<7:
            a[d-1+2][e-1+1]=1
            a[d-1+2][e-1-1]=1
            a[d-1+1][e-1+2]=1
            a[d-1+1][e-1-2]=1
            a[d-1-1][e-1+2]=1
            a[d-1-1][e-1-2]=1
        elif e<8:
            a[d-1+2][e-1+1]=1
            a[d-1+2][e-1-1]=1
            a[d-1+1][e-1-2]=1
            a[d-1-1][e-1-2]=1
        else:
            a[d-1+2][e-1-1]=1
            a[d-1+1][e-1-2]=1
            a[d-1-1][e-1-2]=1
    elif e>1:
        a[d-1+2][e-1+1]=1
        a[d-1+2][e-1-1]=1
        a[d-1+1][e-1+2]=1
        a[d-1-1][e-1+2]=1
    else:
        a[d-1+2][e-1+1]=1
        a[d-1+1][e-1+2]=1
        a[d-1-1][e-1+2]=1
else:
    if e>2:
        if e<7:
            a[d-1+2][e-1+1]=1
            a[d-1+2][e-1-1]=1
            a[d-1+1][e-1+2]=1
            a[d-1+1][e-1-2]=1
        elif e<8:
            a[d-1+2][e-1+1]=1
            a[d-1+2][e-1-1]=1
            a[d-1+1][e-1-2]=1
        else:
            a[d-1+2][e-1-1]=1
            a[d-1+1][e-1-2]=1
    elif e>1:
        a[d-1+2][e-1+1]=1
        a[d-1+2][e-1-1]=1
        a[d-1+1][e-1+2]=1
    else:
        a[d-1+2][e-1+1]=1
        a[d-1+1][e-1+2]=1
d=f
e=g
if d>2:
    if d<7:
        if e>2:
            if e<7:
                a[d-1+2][e-1+1]=1
                a[d-1+2][e-1-1]=1
                a[d-1+1][e-1+2]=1
                a[d-1+1][e-1-2]=1
                a[d-1-1][e-1+2]=1
                a[d-1-1][e-1-2]=1
                a[d-1-2][e-1+1]=1
                a[d-1-2][e-1-1]=1
            elif e<8:
                a[d-1+2][e-1+1]=1
                a[d-1+2][e-1-1]=1
                a[d-1+1][e-1-2]=1
                a[d-1-1][e-1-2]=1
                a[d-1-2][e-1+1]=1
                a[d-1-2][e-1-1]=1
            else:
                a[d-1+2][e-1-1]=1
                a[d-1+1][e-1-2]=1
                a[d-1-1][e-1-2]=1
                a[d-1-2][e-1-1]=1
        elif e>1:
            a[d-1+2][e-1+1]=1
            a[d-1+2][e-1-1]=1
            a[d-1+1][e-1+2]=1
            a[d-1-1][e-1+2]=1
            a[d-1-2][e-1+1]=1
            a[d-1-2][e-1-1]=1
        else:
            a[d-1+2][e-1+1]=1
            a[d-1+1][e-1+2]=1
            a[d-1-1][e-1+2]=1
            a[d-1-2][e-1+1]=1
    elif d<8:
        if e>2:
            if e<7:
                a[d-1-2][e-1+1]=1
                a[d-1-2][e-1-1]=1
                a[d-1-1][e-1+2]=1
                a[d-1-1][e-1-2]=1
                a[d-1+1][e-1+2]=1
                a[d-1+1][e-1-2]=1
            elif e<8:
                a[d-1-2][e-1+1]=1
                a[d-1-2][e-1-1]=1
                a[d-1-1][e-1-2]=1
                a[d-1+1][e-1-2]=1
            else:
                a[d-1-2][e-1-1]=1
                a[d-1-1][e-1-2]=1
                a[d-1+1][e-1-2]=1
        elif e>1:
            a[d-1-2][e-1+1]=1
            a[d-1-2][e-1-1]=1
            a[d-1-1][e-1+2]=1
            a[d-1+1][e-1+2]=1
        else:
            a[d-1-2][e-1+1]=1
            a[d-1-1][e-1+2]=1
            a[d-1+1][e-1+2]=1
    else:
        if e>2:
            if e<7:
                a[d-1-2][e-1+1]=1
                a[d-1-2][e-1-1]=1
                a[d-1-1][e-1+2]=1
                a[d-1-1][e-1-2]=1
            elif e<8:
                a[d-1-2][e-1+1]=1
                a[d-1-2][e-1-1]=1
                a[d-1-1][e-1-2]=1
            else:
                a[d-1-2][e-1-1]=1
                a[d-1-1][e-1-2]=1
        elif e>1:
            a[d-1-2][e-1+1]=1
            a[d-1-2][e-1-1]=1
            a[d-1-1][e-1+2]=1
        else:
            a[d-1-2][e-1+1]=1
            a[d-1-1][e-1+2]=1
elif d>1:
    if e>2:
        if e<7:
            a[d-1+2][e-1+1]=1
            a[d-1+2][e-1-1]=1
            a[d-1+1][e-1+2]=1
            a[d-1+1][e-1-2]=1
            a[d-1-1][e-1+2]=1
            a[d-1-1][e-1-2]=1
        elif e<8:
            a[d-1+2][e-1+1]=1
            a[d-1+2][e-1-1]=1
            a[d-1+1][e-1-2]=1
            a[d-1-1][e-1-2]=1
        else:
            a[d-1+2][e-1-1]=1
            a[d-1+1][e-1-2]=1
            a[d-1-1][e-1-2]=1
    elif e>1:
        a[d-1+2][e-1+1]=1
        a[d-1+2][e-1-1]=1
        a[d-1+1][e-1+2]=1
        a[d-1-1][e-1+2]=1
    else:
        a[d-1+2][e-1+1]=1
        a[d-1+1][e-1+2]=1
        a[d-1-1][e-1+2]=1
else:
    if e>2:
        if e<7:
            a[d-1+2][e-1+1]=1
            a[d-1+2][e-1-1]=1
            a[d-1+1][e-1+2]=1
            a[d-1+1][e-1-2]=1
        elif e<8:
            a[d-1+2][e-1+1]=1
            a[d-1+2][e-1-1]=1
            a[d-1+1][e-1-2]=1
        else:
            a[d-1+2][e-1-1]=1
            a[d-1+1][e-1-2]=1
    elif e>1:
        a[d-1+2][e-1+1]=1
        a[d-1+2][e-1-1]=1
        a[d-1+1][e-1+2]=1
    else:
        a[d-1+2][e-1+1]=1
        a[d-1+1][e-1+2]=1
h=64
for i in range(8):
    for j in range(8):
        h-=a[i][j]
print(h)