#Trevor Sprinkle
#Conrad Weiser High School
#Intermediate 5, problem #1
%hash = ('T' => '30', 'H' => '30', 'S' => '30', 'C'
=> '20', 'D' => '20', 'V' => '100', 'N' => '50'); #Setting up the
hash table
for(1..5){ #For i = 1 to 5 inclusively.
$n1 =
<STDIN>;
$n2 =
<STDIN>;
$chr1 =
<STDIN>;
$chr2 =
<STDIN>;
chomp($chr1);
#Chomp returns the argument without the newline at the end
chomp($chr2); #If
there is no newline, it returns the argument.
$n2 = $n2 - 6;
if($n2 < $n1){
$ans2 =
(($n1-$n2)*$hash{$chr2});#A call to the hash table
$ans =
"0";
}
else{
$ans =
($n1*$hash{$chr1}); #And another
$ans2 = (($n2 -
$n1)*$hash{$chr1}); #Yet another call to the hash table
$ans += 10
if(($chr1 eq "T") and ($ans > 0)); #eq is equality for strings
}
print
"$ans,$ans2\n"; #Any varaible in double quotes is replaced
} #by its value automatically