def calc(d,x): if x==0: return 0 r,q=divmod(x,d-1) ANS=d*(d-1)//2*r+(1+q)*q//2 return ANS T=int(input()) for tests in range(T): d,A,B=map(int,input().split()) print(calc(d,B)-calc(d,A-1))