#!/usr/bin/perl -w

use v5.16;

chomp (my $data = <>);

my @min;
my $count = 25*6;
for my $l ($data =~ /.{$count}/g) {
	say $l;
	my @x;
	$x[0] = () = $l =~ /0/g;
	$x[1] = () = $l =~ /1/g;
	$x[2] = () = $l =~ /2/g;
	@min = @x
		if !defined $min[0] || $min[0] > $x[0];
}

say $min[1] * $min[2];
