#C1493. Calculate Final Stamina
Calculate Final Stamina
Calculate Final Stamina
In this problem, you are given an initial stamina (S), the amount of stamina gained per day (R) (e.g. through running), the amount of stamina lost per day (L) (e.g. through resting), and the number of days (D). Your task is to compute the final stamina after (D) days using the formula: (F = S + D \times (R - L)). You need to process multiple test cases. For each test case, you will be given these four integers and should output a single integer representing the final stamina level. Make sure your solution reads from standard input and writes to standard output.
inputFormat
The first line of input contains an integer (T) representing the number of test cases. Each of the following (T) lines contains four space-separated integers (S), (R), (L), and (D) representing the initial stamina, stamina gained per day, stamina lost per day, and the number of days, respectively.
outputFormat
For each test case, print the final stamina level on a new line. The final stamina is computed using the formula (F = S + D \times (R - L)).## sample
1
50 10 5 7
85
</p>