def g(N): Q,R=divmod(N,D-1) return Q*(D*(D-1))//2+(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)))