data = [[0, 4, 5], [1, 2, 6, 7], [0, 1, 2, 5], [1, 5, 6], [0, 5, 7], [2, 3, 4, 5, 7], [1, 6], [0, 3, 4], [0, 1, 2], [0, 1, 2, 3, 5], [0], [2, 4, 5, 7], [1, 2, 3, 6], [3, 4, 5], [4], [0, 2, 5, 7], [0, 1, 3, 5, 6, 7], [1, 2, 4, 5, 6], [0, 2, 5, 6], [0, 3, 7], [0, 2, 3, 4, 5], [0, 5], [0, 7], [0, 2, 3, 4, 7], [0, 1, 3, 5], [2, 3, 4, 6, 7], [0, 1, 4, 5, 6], [0, 1, 2, 3, 6], [3, 4, 5, 6], [0, 3, 4, 5, 7], [0, 1, 4, 7], [0, 1, 5, 6, 7], [1, 2, 5, 7], [3, 4, 5, 6], [0, 3, 4, 5, 6, 7]]
flag_alphabet = "+-=ABCDEFGHIJKLMNOPQRSTUVWXYZ_{}"

r = ""
for d in data:
	v = 0
	for c in d:
		v += 1 << (7 - c)
		#v += 1 << c
	r += chr(v)
i = int(r.encode("hex"), 16)

print bin(i)

bins = bin(i)[2:]

r = ""
for i in range(0, len(bins), 5):
	s = bins[i:i + 5]
	r += flag_alphabet[eval("0b" + s)]
print r

data = [[0, 4, 5], [1, 2, 6, 7], [0, 1, 2, 5], [1, 5, 6], [0, 5, 7], [2, 3, 4, 5, 7], [1, 6], [0, 3, 4], [0, 1, 2], [0, 1, 2, 3, 5], [0], [2, 4, 5, 7], [1, 2, 3, 6], [3, 4, 5], [4], [0, 2, 5, 7], [0, 1, 3, 5, 6, 7], [1, 2, 4, 5, 6], [0, 2, 5, 6], [0, 3, 7], [0, 2, 3, 4, 5], [0, 5], [0, 7], [0, 2, 3, 4, 7], [0, 1, 3, 5], [2, 3, 4, 6, 7], [0, 1, 4, 5, 6], [0, 1, 2, 3, 6], [3, 4, 5, 6], [0, 3, 4, 5, 7], [0, 1, 4, 7], [0, 1, 5, 6, 7], [1, 2, 5, 7], [3, 4, 5, 6], [0, 3, 4, 5, 6, 7]]
flag_alphabet = "+-=ABCDEFGHIJKLMNOPQRSTUVWXYZ_{}"

r = ""
for d in data:
	v = 0
	for c in d:
		v += 1 << (7 - c)
		#v += 1 << c
	r += chr(v)
i = int(r.encode("hex"), 16)

print bin(i)

bins = bin(i)[2:]

r = ""
for i in range(0, len(bins), 5):
	s = bins[i:i + 5]
	r += flag_alphabet[eval("0b" + s)]
print r

#v += 1 << c