Problem: <image>

Input

The input contains two integers a1, a2 (0 ≤ ai ≤ 32), separated by a single space.

Output

Output a single integer.

Examples

Input

1 1


Output

0


Input

3 7


Output

0


Input

13 10


Output

1

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;

public class task_h implements Runnable {
	public StringTokenizer strtok;
	public BufferedReader inr;
	public PrintWriter out;

	public static void main(String[] args) {
		new Thread(new task_h()).start();
	}

	public static final String taskname = "curve";

	public void run() {
		Locale.setDefault(Locale.US);
		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
		try {
			inr = new BufferedReader(oj ? new InputStreamReader(System.in, "ISO-8859-1") : new FileReader(taskname + ".in"));
			out = new PrintWriter(oj ? new OutputStreamWriter(System.out, "ISO-8859-1") : new FileWriter(taskname + ".out"));
			solve();
		} catch (Exception e) {
			if (!oj)
				e.printStackTrace();
			System.exit(9000);
		} finally {
			out.flush();
			out.close();
		}
	}

	public String nextToken() throws IOException {
		while (strtok == null || !strtok.hasMoreTokens()) {
			strtok = new StringTokenizer(inr.readLine());
		}
		return strtok.nextToken();
	}

	public int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}

	Point d2xy(int n, int d) {
	    int rx, ry, s, t=d;
	    int x = 0, y = 0;
	    for (s = 1; s < n; s *= 2) {
	        rx = 1 & (t/2);
	        ry = 1 & (t ^ rx);
	        Point pt = rot(s, x, y, rx, ry);
	        x = pt.x;
	        y = pt.y;
	        x += s * rx;
	        y += s * ry;
	        t /= 4;
	    }
	    return new Point(x, y);
	}
	 
	Point rot(int n, int x, int y, int rx, int ry) {
	    int t;
	    if (ry == 0) {
	        if (rx == 1) {
	            x = n-1 - x;
	            y = n-1 - y;
	        }
	        t  = x;
	        x = y;
	        y = t;
	    }
	    return new Point(x, y);
	}

	// Solution

	public void solve() throws NumberFormatException, IOException {
		int a = nextInt();
		int b = nextInt();
		Point pt = d2xy(1 << a, b);
		out.print(pt.x + " " + pt.y);
	}
}

class Point {
	int x, y;

	public Point(int x, int y) {
		this.x = x;
		this.y = y;
	}
}