import sys
from collections import Counter


def get_rating(numbers, picker):
    for x in range(len(numbers[0])):
        counter = Counter(n[x] for n in numbers)
        _, bit = picker((n, k) for k, n in counter.items())
        numbers = [n for n in numbers if n[x] == bit]

    return int(numbers[0], 2)


def get_oxygen_generator_rating(numbers):
    return get_rating(numbers, max)


def get_co2_scrubber_rating(numbers):
    return get_rating(numbers, min)


def main():
    numbers = [line.strip() for line in sys.stdin]
    print(get_oxygen_generator_rating(numbers) * get_co2_scrubber_rating(numbers))


if __name__ == "__main__":
    main()
