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 javafx.util.Pair;
import org.omg.CORBA.MARSHAL;

import java.io.*;
import java.math.*;
import java.util.*;


// author @mdazmat9
public  class codeforces{

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int test = 1;
        for (int ind = 0; ind < test; ind++) {
        String s1=sc.next();
        String s2=sc.next();
        int x1=s1.charAt(0)-96;
        int y1=s1.charAt(1)-'0';

        int x2=s2.charAt(0)-96;
        int y2=s2.charAt(1)-'0';
            HashMap<Pair,Integer> map=new HashMap<>();
            Pair<Integer,Integer> p1=new Pair(x1,y1);
            int c = map.containsKey(p1) ? map.get(p1) : 0;
            map.put(p1, c + 1);
            p1=new Pair<>(x2,y2);
            c = map.containsKey(p1) ? map.get(p1) : 0;
            map.put(p1, c + 1);


        for(int i=1;i<=8;i++){
            Pair<Integer,Integer> p=new Pair(x1,i);
            int count = map.containsKey(p) ? map.get(p) : 0;
            map.put(p, count + 1);
        }
        for(int i=1;i<=8;i++){
                Pair p=new Pair(i,y1);
                int count = map.containsKey(p) ? map.get(p) : 0;
                map.put(p, count + 1);
            }
         int []dx={2,2,-2,-2,1,-1,1,-1};
        int [] dy={1,-1,1,-1,2,2,-2,-2};


        for (int i=0;i<8;i++){
            int x=x1+dx[i];
            int y=y1+dy[i];
            Pair<Integer,Integer> p=new Pair<>(x,y);
            int count = map.containsKey(p) ? map.get(p) : 0;
            map.put(p, count + 1);
        }
            for (int i=0;i<8;i++){
                int x=x2+dx[i];
                int y=y2+dy[i];
                Pair<Integer,Integer> p=new Pair<>(x,y);
                int count = map.containsKey(p) ? map.get(p) : 0;
                map.put(p, count + 1);
            }
            int ans=0;
            for(int i=1;i<=8;i++) {
                for (int j = 1; j <= 8; j++) {
                    Pair<Integer, Integer> p = new Pair<>(i, j);
                    if (!map.containsKey(p))
                        ans++;
                }
            }
            out.println(ans);

          //  out.println(map);





        }
        out.flush();
    }

    static   void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    static long gcd(long a , long b)
    {
        if(b == 0)
            return a;
        return gcd(b , a % b);
    }

}
class Scanner {
    public BufferedReader reader;
    public StringTokenizer st;

    public Scanner(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        st = null;
    }

    public String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = reader.readLine();
                if (line == null) return null;
                st = new StringTokenizer(line);
            } catch (Exception e) {
                throw (new RuntimeException());
            }
        }
        return st.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

class OutputWriter {
    BufferedWriter writer;

    public OutputWriter(OutputStream stream) {
        writer = new BufferedWriter(new OutputStreamWriter(stream));
    }

    public void print(int i) throws IOException {
        writer.write(i);
    }

    public void print(String s) throws IOException {
        writer.write(s);
    }

    public void print(char[] c) throws IOException {
        writer.write(c);
    }

    public void close() throws IOException {
        writer.close();
    }

}