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

public class ege_pk {
	public static void main(String[] args) {
		new ege_pk().run();
	}

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

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

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

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

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

	int get(long x) {
		int ans = 0;
		while (x > 0) {
			ans += x % 2;
			x /= 2;
		}
		return ans;
	}

	public void solve() throws IOException {
		long k = nextLong();
		long n = nextLong();
		assert((2 <= k) && (k <= 63));
		long t = (long)1 << k;
		assert((1 <= n) && (n <= t - 6));
		for (int i = -1; i <= 5; i++) {
			out.print(get(n + i) % 2);
		}
		out.println();
	}

	public void run() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			br = new BufferedReader(new FileReader("ege.in"));
			out = new PrintWriter("ege.out");

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}