Little Bobby loves chocolate. He frequently goes to his favorite store, Penny Auntie, to buy them. They are having a promotion at Penny Auntie. If Bobby saves enough wrappers, he can turn them in for a free chocolate.

Example


He has to spend, bars cost , and he can turn in wrappers to receive another bar. Initially, he buys bars and has wrappers after eating them. He turns in of them, leaving him with , for more bars. After eating those two, he has wrappers, turns in leaving him with wrapper and his new bar. Once he eats that one, he has wrappers and turns them in for another bar. After eating that one, he only has wrapper, and his feast ends. Overall, he has eaten bars.

Function Description

Complete the chocolateFeast function in the editor below.

chocolateFeast has the following parameter(s):

  • int n: Bobby's initial amount of money
  • int c: the cost of a chocolate bar
  • int m: the number of wrappers he can turn in for a free bar

Returns

  • int: the number of chocolates Bobby can eat after taking full advantage of the promotion

Note: Little Bobby will always turn in his wrappers if he has enough to get a free chocolate.

Input Format

The first line contains an integer, , the number of test cases to analyze.
Each of the next lines contains three space-separated integers: , , and . They represent money to spend, cost of a chocolate, and the number of wrappers he can turn in for a free chocolate.

Constraints

Sample Input

STDIN   Function
-----   --------
3       t = 3 (test cases)
10 2 5  n = 10, c = 2, m = 5 (first test case)
12 4 4  n = 12, c = 4, m = 4 (second test case)
6 2 2   n = 6,  c = 2, m = 2 (third test case)

Sample Output

6
3
5

Explanation

Bobby makes the following trips to the store:

  1. He spends on chocolates at apiece. He then eats them and exchanges all wrappers to get more. He eats chocolates.
  2. He spends his on chocolates at apiece. He has wrappers, but needs to trade for his next chocolate. He eats chocolates.
  3. He spends on chocolates at apiece. He then exchanges of the wrappers for additional piece. Next, he uses his third leftover chocolate wrapper from his initial purchase with the wrapper from his trade-in to do a second trade-in for more piece. At this point he has wrapper left, which is not enough to perform another trade-in. He eats chocolates.
Line: 1 Col: 1
  1. Challenge Walkthrough
    Let's walk through this sample challenge and explore the features of the code editor.1 of 6
  2. Review the problem statement
    Each challenge has a problem statement that includes sample inputs and outputs. Some challenges include additional information to help you out.2 of 6
  3. Choose a language
    Select the language you wish to use to solve this challenge.3 of 6
  4. Enter your code
    Code your solution in our custom editor or code in your own environment and upload your solution as a file.4 of 6
  5. Test your code
    You can compile your code and test it for errors and accuracy before submitting.5 of 6
  6. Submit to see results
    When you're ready, submit your solution! Remember, you can go back and refine your code anytime.6 of 6
  1. Check your score