(RankList for this Question)
Max, an avid gamer, is on the verge of completing a captivating video game. With sheer determination, he aims to conquer the remaining X levels in a single relentless session. Each level demands Y minutes for Max's adept gameplay. However, in his pursuit of victory, Max's acknowledges the importance of safeguarding his eyesight. Hence, he institutes a practice wherein he pauses for a strategic break of Z minutes every time he successfully clears 3 levels. Notably, this breather is forgone once he completes the entire game.
Calculate the total time, in minutes, that Max will expend to successfully accomplish the game under these conditions. Provide your answer in terms of X, Y, and Z.
Note: Assume that Max's starts playing from the beginning of the game and that his breaks are only taken after completing groups of 3 levels. Disregard any additional factors that might affect gameplay time.
The first line of input will contain a single integer T, denoting the number of test cases.
The first and only line of input will contain three space-separated integers X,Y, and Z.
For each test case, output on a new line the answer - the length of Max's gaming session.
2 12 10
3 12 10
7 20 8
24 45 15
Test case 1:
here value of x=2,y=12 and z=10 so as x is less then 3 so no relation is needed so answer will be 2*12 i.e 24.
Test case 2:
here x=3,y=12 and z=10 so as gamer can play consecutively 3 games so no break is required so answer would be 3*12 i.e 36.
Test case 3:
here x=7,y=20 and z=8 so gamer can play 3 levels then take a break and then after that play more 3 levels then take a break and then play one level left so answer is 7(levels)*20+2(breaks)*8=140+16=156.
Log In to solve the Question