t = int(input()) def func(x, d): q, r = divmod(x, d-1) ans = q*(d-1)*d//2 ans += r*(r+1)//2 return ans for _ in range(t): d, a, b = map(int, input().split()) print(func(b, d)-func(a-1, d))