use strict; use warnings; use utf8; my $T = ; my @inputs = (); my @answers = (); for (my $i = 0; $i < $T; $i++) { my $input = ; chomp($input); push @inputs, $input; } foreach my $str (@inputs) { my ($A, $B) = split / /, $str; my $result = $B + ($A * $B); push @answers, $result; } my $answer = join "\n", @answers; print $answer;