38_B. Chess
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
```python


l=[]
for i in range(1,9):
    for j in range(1,9):
        l.append(int(str(i)+str(j)))
l2=[]
def check(l2,c,d):
    if c+1<=8 and d+2<=8:
        l2.append(int(str(c+1)+str(d+2)))
    if c+2<9 and d+1<9:
        l2.append(int(str(c+2)+str(d+1)))
    if c-1>0 and d-2>0:
        l2.append(int(str(c-1)+str(d-2)))
    if c-2>0 and d-1>0:
        l2.append(int(str(c-2)+str(d-1)))
    if c+1<9 and d-2>0:
        l2.append(int(str(c+1)+str(d-2)))
    if c-1>0 and d+2<9:
        l2.append(int(str(c-1)+str(d+2)))
    if c+2<9 and d-1>0:
        l2.append(int(str(c+2)+str(d-1)))
    if c-2>0 and d+1<9:
        l2.append(int(str(c-2)+str(d+1)))
#input
r=input()
k=input()
r1=str(ord(r[0])-96)+r[1]
k1=str(ord(k[0])-96)+k[1]


#for rook given
a,b=int(r1[0]),int(r1[1])
# print(a,b)
for i in range(1,9):
    for j in range(1,9):
        if i==a or j==b:
            l2.append(int(str(i)+str(j)))
check(l2,a,b)
 
    
    
#for knight
c,d=int(k1[0]),int(k1[1])
check(l2,c,d)
l2.append(int(str(c)+str(d)))   #pos of curr knight
#answer    
print(64-len(set(l2)))    
    
    
    
    
    
    
    
    
    

```