def suti(S): if S%d==0: return d else: return S%d Q=int(input()) for i in range(Q): d,a,b=map(int,input().split()) d-=1 s=(b-a)//d ans=(((1+d)*d)//2)*s if a==0: if b==0: print(0) continue else: a=1 a=suti(a) b=suti(b) if a