# your code goes here
__author__ = 'hariom'
# Enter your code here. Read input from STDIN. Print output to STDOUT
T = int(raw_input())
for i in range (0,T):
A,B,C1 = [int(x) for x in raw_input().split(' ')]
answer = 0
wr = 0
# write code to compute answer
while A>0 and A >= B:
A -= B ; answer +=1
wr +=1
if wr == C1:
answer +=1
wr = 1
print answer