#K16061. Baking Time Calculation
Baking Time Calculation
Baking Time Calculation
You are given an oven that requires a preheating time and a fixed baking time for each batch of cookies. Given four integers:
- O: the oven preheat time.
- B: the baking time for one batch of cookies.
- C: the total number of cookies to be baked.
- P: the number of cookies that can be baked in one batch.
You need to calculate the total time required to bake all cookies. The total time is given by the formula:
$$T = O + B \cdot \lceil \frac{C}{P} \rceil$$
where \(\lceil x \rceil\) denotes the ceiling function.
inputFormat
The input is read from stdin and consists of multiple test cases. The first line contains an integer T representing the number of test cases. Each of the next T lines contains four space-separated integers: O, B, C, and P.
outputFormat
For each test case, output the computed total baking time on a new line to stdout.
## sample3
10 15 30 10
20 25 100 20
5 10 5 5
55
145
15
</p>