def g(N): if N==0: return 0 if N%(D-1)==0: Q=N//(D-1) R=0 else: Q=N//(D-1)+1 R=D-1-N%(D-1) return Q*(D*(D-1))//2-D*R+(R*(R+1))//2 T=int(input()) X=[0]*T for k in range(T): D,A,B=map(int,input().split()) X[k]=g(B)-g(max(A-1,0)) print("\n".join(map(str,X)))