my $ans = 1; for (my $i = 0; $i < 3; $i++) { $_ = <>; chomp; $a = 16 - s/,//g - 1; if ($_ eq "NONE") { $a = 16; } $ans *= $a * $a; } print$ans;