#C10450. Total Fruits Calculation

    ID: 39657 Type: Default 1000ms 256MiB

Total Fruits Calculation

Total Fruits Calculation

Johnny and Sarah are on a fruit collection spree! Initially, Johnny has \(P\) fruits and Sarah has \(Q\) fruits. In every turn, Johnny collects an extra \(J\) fruits and Sarah collects an extra \(S\) fruits. After \(M\) turns, their total fruit counts can be computed as follows:

Johnny's total fruits: \(P + J \times M\)
Sarah's total fruits: \(Q + S \times M\)

Your task is to process multiple test cases and, for each one, output the final counts for both Johnny and Sarah.

inputFormat

The first line of input contains an integer (T), the number of test cases. Each of the following (T) lines contains five space-separated integers: (P), (Q), (J), (S), and (M).

outputFormat

For each test case, output two integers separated by a space. The first integer is the total number of fruits Johnny collects and the second is for Sarah. Each test case output should be on a new line.## sample

3
1 2 1 2 1
0 0 3 4 2
5 10 2 1 5
2 4

6 8 15 15

</p>