t=int(input()) for _ in range(t): d,a,b=map(int,input().split()) ans=b-a+1 a-=1 b-=1 first=a%(d-1) last=b%(d-1) ans+=(((d-2)*(d-1))//2)*(b//(d-1)) ans-=(((d-2)*(d-1))//2)*(a//(d-1)) ans+=((last*(last+1))//2) ans-=((first*(first-1))//2) if a==-1: ans-=d-1 print(ans)