import java.io.*;
public class Main {
	private static void recurse(int x, int n) {
		if(0 != (x & 1073741824))
			recurse(x * 2, n - n / n);
		else
			recurse(x * 2, n - n / n);
	}
	public static void main(String[] args) {
		int x = 0, y = Integer.parseInt(args[0]);
		try {
			recurse(Integer.parseInt(args[1]), 30);
		} catch (Exception e) {
			StringWriter s = new StringWriter();
			e.printStackTrace(new PrintWriter(s));
			for(byte b : s.toString().getBytes()) switch(b) {
				case 53: x += y;
				case 55: y += y;
			}
		}
		System.out.println(x);
	}
}

