Limits 2s, 512 MB

Bob is making a new application for Android phones. Front-end of his app has a button like this:

When he press the button, a process starts in the back-end. The process needs k seconds to complete. During this k seconds the button looks like this:

To check if a process is completed, Bob wrote a special checker which always runs in the background. The checker checks the progress in every d seconds starting from the moment someone pressed the button. If it sees that the process is completed, it changes the text of the button.

Suppose the user pressed the button in the pp-th second. Given the value of pp, kk and dd, can you find when the button will display “Done!”?

Input

First line will consist TT (1T10001 \le T \le 1000), denoting number of testcases. For each testcase, there are 3 space separated integers, pp (1p1001 \le p \le 100), kk (1k10001 \le k \le 1000) and dd (1d10001 \le d \le 1000).

Output

For each case, print the case number and the answer.

Sample

InputOutput
1
10 14 8
Case 1: 26

Submit

Login to submit.

Statistics

77% Solution Ratio
rofi93Earliest, Dec '16
rofi93Fastest, 0.0s
fahad_69Lightest, 0 B
Nusab19Shortest, 82B
Toph uses cookies. By continuing you agree to our Cookie Policy.