#include using namespace std; using ll = long long; ll f(ll x, ll d){ if (x <= 0) return 0; ll q = x/(d-1), r = x % (d-1), s = d*(d-1)/2; return q*s + r*(r+1)/2; } void solve(){ ll d, a, b; cin >> d >> a >> b; cout << f(b, d)-f(a-1, d) << endl; } int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); int T; cin >> T; while(T){ T--; solve(); } return 0; }