import sys def input(): return sys.stdin.buffer.readline()[:-1] def f(d, x): if x <= 0: return 0 else: res = 0 res += (d * (d-1) // 2) * ((x-1) // (d-1)) res += ((x-1) % (d-1) + 1) * ((x-1) % (d-1) + 2) // 2 return res for _ in range(int(input())): d, a, b = map(int, input().split()) print(f(d, b) - f(d, a-1))