#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int T; cin >> T; while(T--){ ll D, A, B, L, R, ans = 0; cin >> D >> A >> B; A += (A == 0); D--, A--; L = (A + D - 1) / D, R = B / D; if(L < R) ans += (R - L) * D * (D + 1) / 2; A %= D, B %= D; if(A == 0) A = D; if(L <= R){ ans += D * (D + 1) / 2 - A * (A + 1) / 2; ans += B * (B + 1) / 2; }else{ ans += B * (B + 1) / 2 - A * (A + 1) / 2; } cout << ans << '\n'; } }