#!/usr/bin/env python3

import sys
import re

def bmpc_bits(bitstream):
	prev = bitstream[0]
	it = iter(bitstream)
	while next(it) == prev:
		pass
	prev = 1 * (not prev)
	while True:
		yield 1 * (next(it) != prev)
		prev = next(it)

def bits2words(bits):
	accum = 0
	count = 0
	for bit in bits:
		accum = (accum << 1) | bit
		count += 1
		if count >= 32:
			yield accum
			accum = 0
			count = 0

bits = []

f = open(sys.argv[1])
for l in f:
	l = l.strip()
	if len(l) == 1 and l.isdigit():
		bits.append(int(l))

print(list(hex(x) for x in bits2words(bmpc_bits(bits))))