- #include <bits/stdc++.h>
- #define ll long long int
- #define ld long double
- using namespace std;
-
- const ll N = 50010;
- const ll mod = 1e9 + 7;
- vector <long long> v;
- ll sum[N], squaresum[N];
-
- void mainSolve()
- {
- ll n;
- cin >> n;
- int indx = upper_bound(v.begin(), v.end(), n) - v.begin() - 1;
- ll ans = (n * sum[indx] - squaresum[indx] + mod) % mod;
- cout << ans << '\n';
- }
-
- int main()
- {
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- int t;
- cin >> t;
- for (int i = 1; i <= 100000; i++)
- {
- ll tmp = (i * (i - 1)) / 2;
- if (tmp > 1e9)
- break;
- v.push_back(tmp);
- }
- for (int i = 1; i < v.size(); i++)
- {
- sum[i] = sum[i - 1] + v[i];
- squaresum[i] = squaresum[i - 1] + v[i] * v[i];
- sum[i] %= mod;
- squaresum[i] %= mod;
- }
- while (t--)
- {
- mainSolve();
- }
- return 0;
- }