#include #include using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 2000000001 long long sum(long long x){ return x * (x+1) / 2; } long long get(long long x,long long d){ long long ret = sum(d-1); ret *= x/(d-1); ret += sum(x%(d-1)); return ret; } int main(){ int T; cin>>T; rep(_,T){ long long d,A,B; cin>>d>>A>>B; long long ans = get(B,d); if(A!=0)ans -= get(A-1,d); cout<