def f(a, d): if a <= 0: return 0 q, r = divmod(a, d - 1) return q * d * (d - 1)//2 + r * (r + 1)//2 T = int(input()) for _ in range(T): d, A, B = map(int, input().split()) print(f(B, d) - f(A - 1, d))