// Arup Guha
// 3/21/2017
// Solution to 1991 UCF HS Contest Problem: Parity Checking

import java.util.*;

public class parity {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);

		// Read till eof
		while (stdin.hasNext()) {

			// Get input and calculate the parity of the row sum.
			int[] bits = new int[8];
			int mod = 0;
			for (int i=0; i<8; i++) {
				bits[i] = stdin.nextInt();
				mod = (mod+bits[i])%2;
			}

			// Echo input, then print out result.
			for (int i=0; i<8; i++)
				System.out.print(bits[i]);
			System.out.println(" "+mod);
		}
	}
}