import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def f(D, N): # sum_{i=1}^N q, r = divmod(N, D) x = D * (D + 1) // 2 * q x += r * (r + 1) // 2 return x T = int(readline()) for _ in range(T): D, A, B = map(int, readline().split()) x = f(D - 1, B) - f(D - 1, A - 1) print(x)