#C10428. Max Vehicles Through Intersection

    ID: 39632 Type: Default 1000ms 256MiB

Max Vehicles Through Intersection

Max Vehicles Through Intersection

You are given an intersection controlled by a traffic light. Two roads feed into this intersection with constant vehicle arrival rates. For each test case, the rates of vehicles arriving from the two roads are given by N and M (vehicles per unit time). The traffic light stays green for a duration of G seconds in each cycle. Although additional parameters (R and D) are provided, the total number of vehicles that can pass in one cycle is determined by the green light duration.

The total number of vehicles that can pass during a green light is computed by the formula:

\( \text{Total Vehicles} = (N + M) \times G \)

For each test case, compute the number of vehicles that can pass through the intersection during one complete cycle.

inputFormat

The first line of the input contains one integer T indicating the number of test cases. Each of the following T lines contains five space-separated integers: N, M, G, R, and D. Here, N and M represent the vehicle arrival rates (vehicles per unit time) from two roads, G is the green light duration, and R and D are additional parameters (which can be ignored for the calculation).

outputFormat

For each test case, output a single integer on a new line, representing the total number of vehicles that can pass during one cycle of the traffic light. The result is computed using:

\( (N + M) \times G \)

## sample
3
10 15 5 3 8
20 25 7 2 9
30 35 4 4 8
125

315 260

</p>