import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) def cnt(val, d): if val <= 0: return 0 d -= 1 div, mod = divmod(val, d) res = d * (d + 1)//2 * div + mod * (mod + 1) // 2 return res def test(): d, A, B = map(int, input().split()) return cnt(B, d) - cnt(A-1, d) T = int(input()) for _ in range(T): print(test())