#!/usr/bin/perl -w

use v5.16;

my ($c, @s);

while (<>) {
	$c++;
	chomp;
	my $i = 0;
	for my $b (split//) {
		$s[$i++] += $b;
	}
}

my ($e, $g);
for my $b (@s) {
	$e .= ($b > $c/2) ? '1' : '0';
	$g .= ($b > $c/2) ? '0' : '1';
}

say oct("0b$e")*oct("0b$g");

