#!/usr/bin/env python3 import sys # First get the counts of bit by position counts = [] first = True for l in sys.stdin: i = 0 for c in l.strip(): if first: counts.append([0, 0]) counts[i][int(c)] += 1 i += 1 first = False # Then build up the binary string summaries gamma = "" eps = "" for c in counts: if c[0] > c[1]: gamma += "0" eps += "1" else: gamma += "1" eps += "0" print(int(gamma, 2) * int(eps, 2))