#include <bits/stdc++.h>
using namespace std;
#define file(NAME) if (fopen(NAME".inp", "r")) freopen(NAME".inp", "r", stdin), freopen(NAME".out", "w", stdout)
#define FOR(i, a, b) for (int i = (int) a; i <= (int) b; ++i)
#define FOD(i, a, b) for (int i = (int) a; i >= (int) b; --i)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
const int maxn = 1e5 + 5;
const int N = 505;
const int MOD = 1e9 + 7;
ll n;
ll power(ll a, ll b) {
ll res = 1;
while (b) {
if (b & 1) res = (res * a % MOD) % MOD;
a = (a * a) % MOD;
b >>= 1;
}
return res;
}
// sum 1 -> n
ll sum(ll n) {
// n * (n + 1) / 2
return (((n%MOD * (n+1)%MOD)%MOD) * power(2, MOD - 2)) % MOD;
}
ll calc(ll i, ll j, ll q) {
// (sum(j-1) - sum(i-1)) * q
return ((sum(j-1) - sum(i-1) + MOD)%MOD * q%MOD) % MOD;
}
signed main() {
cin.tie(0) -> sync_with_stdio(0);
file("x");
cin >> n;
ll ans = 0;
ll i = 1;
while (i <= n) {
ll q = n / i;
ll j = n / q + 1;
(ans += calc(i, j, q)) %= MOD;
i = j;
}
cout << ans;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKI2RlZmluZSBmaWxlKE5BTUUpIGlmIChmb3BlbihOQU1FIi5pbnAiLCAiciIpKSAgZnJlb3BlbihOQU1FIi5pbnAiLCAiciIsIHN0ZGluKSwgZnJlb3BlbihOQU1FIi5vdXQiLCAidyIsIHN0ZG91dCkKI2RlZmluZSBGT1IoaSwgYSwgYikgZm9yIChpbnQgaSA9IChpbnQpIGE7IGkgPD0gKGludCkgYjsgKytpKQojZGVmaW5lIEZPRChpLCBhLCBiKSBmb3IgKGludCBpID0gKGludCkgYTsgaSA+PSAoaW50KSBiOyAtLWkpCgojZGVmaW5lIGFsbChzKSAocykuYmVnaW4oKSwgKHMpLmV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