Problem
- Bob has an account in the Bobby Bank. His current account balance is W rupees.
- Each month, the office in which Bob works deposits a fixed amount of X rupees to his account.
- Y rupees is deducted from Bob's account each month as bank charges.
- Find his final account balance after Z months. Note that the account balance can be negative as well.
Input Format
- The first line will contain TT, the number of test cases. Then the test cases follow.
- Each test case consists of a single line of input, containing four integers W,X,Y, and Z — the initial amount, the amount deposited per month, the amount deducted per month, and the number of months.
Output Format
- For each test case, output in a single line the final balance in Bob's account after Z months.
Constraints
Input
- 3 100 11 1 10 999 25 36 9 2500 100 125 101
Output
- 200 900 -25
Explanation:
Test case : Bob's current account balance is . At the end of each month Bob gets Rs and pays Rs , thus gaining per month. Thus, at the end of months, Bob will have .
Test case : Bob's current account balance is . At the end of each month Bob gets Rs and pays Rs , thus losing per month. Thus, at the end of months, Bob will have .
Test case : Bob's current account balance is . At the end of each month Bob gets Rs and pays Rs , thus losing per month. Thus, at the end of months, Bob will have .