t=int(input()) for _ in range(t): d,a,b=map(int,input().split()) def calc(n): if n==0: return 1 else: block=(n-1)//(d-1) k=n%(d-1) if k==0: k=d-1 return 1+(block*((d-1)*d))//2+(k*(k+1))//2 if a==0: ans=calc(b)-calc(a) else: ans=calc(b)-calc(a-1) print(ans)