Richard is planning to build a bowling alley for his gaming zone.Help Richard build it by coding a scoreboard for the same.
Details of this scoreboard: A player will be given three chances to hit the bottles ,after every hit 9 new bottles will be replaced.
Player scores 10 points with a 9/9 hit out of the given three chances.
Player scores a 0 if he is unable to hit 9/9 bottles in any of the given three chances.
+2 are awarded for hitting no. of bottles less than 9 and more than 6. +1 is rewarded for hitting no. of bottles less than 7 and more than 0.
If the player hits 9/9 in the second chance -3 points are deducted from the final score.
If the player hits 9/9 in the third chance -6 points are deducted from the final score.
Scores of hits after a 9/9 hit are not considered in the final score.
INPUT 'T' No. of test cases. 'A' Number of bottles hit in the first chance. 'B' Number of bottles hit in the second chance. 'C' Number of bottles hit in the third chance.
OUTPUT Final score.
CONSTRAINTS
T>0 & T<=20
0<=A<=9
0<=B<=9
0<=C<=9