def solve(a, d): q, m = divmod(a, d-1) res = d * (d-1) // 2 * q + m * (m+1) // 2 return res T = int(input()) for _ in range(T): d, A, B = map(int, input().split()) ans = solve(B, d) - solve(A-1, d) print(ans)