// Arup Guha
// 2/11/2017
// Solution to 2016 German Programming Contest Problem D: Matrix Cypher

import java.util.*;
import java.math.*;

public class d {
	
	public static void main(String[] args) {
		
		Scanner stdin = new Scanner(System.in);
		BigInteger[][] m = new BigInteger[2][2];
		
		// Annoying we have to store this in a big int array...
		for (int i=0; i<4; i++)
			m[i/2][i%2] = new BigInteger(stdin.next());
			
		String res = "";

		// Go backwards peeling off bits 1 by 1 until we get back to the identity matrix.
		while (!identity(m)) {
			
			// Top row is smaller, subtract it from the bottom row, adding a 0 to the output.
			if (m[0][0].compareTo(m[1][0]) < 0 || m[0][1].compareTo(m[1][1]) < 0) {
				res = res + "0";
				for (int i=0; i<2; i++)
					m[1][i] = m[1][i].subtract(m[0][i]);
			}
			
			// Bottom row is smaller, subtract it from the top row, adding a 1 to the output.
			else {
				res = res + "1";
				for (int i=0; i<2; i++)
					m[0][i] = m[0][i].subtract(m[1][i]);
			}
		}
		
		System.out.println(res);
	}
	
	// More annoying than I thought since I wrote it generally!
	public static boolean identity(BigInteger[][] m) {
		
		for (int i=0; i<m.length; i++)
			if (!m[i][i].equals(BigInteger.ONE))
				return false;
		for (int i=0; i<m.length; i++) {
			for (int j=0; j<m[0].length; j++) {
				if (i==j) continue;
				if (!m[i][j].equals(BigInteger.ZERO))
					return false;
			}
		}
		return true;
	}
	
}