#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } long long f(long long n, long long d) { long long per = n / (d - 1); long long m = n % (d - 1); long long res = per * (d - 1) * d / 2; res += m * (m + 1) / 2; return res; } int main() { fast_io(); int t; cin >> t; for (; t--;) { long long d, a, b; cin >> d >> a >> b; if (a == 0) { if (b == 0) { cout << "0\n"; continue; } a++; } cout << f(b, d) - f(a - 1, d) << "\n"; } }