ll T,d,A,B,a,b;{rd(T);REP(T)rd(d,A,B),if(A)A--,d--,a=A%d,b=B%d,wt(((B/d-A/d)*d*(d+1)+b*b+b-a*a-a)/2);}