#include<bits/stdc++.h>
#define file ""
using namespace std;
#define int long long
#define ld long double
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define sz(x) x.size()
const int N=1e6+5;
const int NN=1e3+9;
const int MOD=1e9+7;
const int dx[4]={0, -1, 0, 1};
const int dy[4]={-1, 0, 1, 0};
const int INF=1e18;
const ld eps=1e-6;
const ld pi=acos(-1.0); // 48 digits
int n, inv;
int Pow(int a, int b) {
if (b==0) return 1;
if (b==1) return a;
int tmp=Pow(a,b/2)%MOD;
if (b&1) return (((tmp*tmp)%MOD)*a)%MOD;
return (tmp*tmp)%MOD;
}
int Sum_range(int n) {
n%=MOD;
int res=(((n*(n+1))%MOD)*inv)%MOD;
return res;
}
int Sum(int n) {
int res=0;
int l=1;
int r=1;
while (l<=n) {
int same=n/l;
r=n/same;
int tmp1=((Sum_range(r)-Sum_range(l-1))%MOD+MOD)%MOD;
int tmp2=(same*tmp1)%MOD;
res=(res+tmp2)%MOD;
l=r+1;
}
return res;
}
void process() {
// Code here :V
cin>>n;
inv=Pow(2,MOD-2);
cout<<Sum(n);
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
// freopen(file".inp","r",stdin);
// freopen(file".out","w",stdout);
int t=1;
// cin>>t;
while (t--) process();
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBmaWxlICIiCgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKI2RlZmluZSBpbnQgbG9uZyBsb25nCiNkZWZpbmUgbGQgbG9uZyBkb3VibGUKI2RlZmluZSBwaWkgcGFpcjxpbnQsaW50PgojZGVmaW5lIHBiIHB1c2hfYmFjawojZGVmaW5lIG1wIG1ha2VfcGFpcgojZGVmaW5lIFggZmlyc3QKI2RlZmluZSBZIHNlY29uZAojZGVmaW5lIGxiIGxvd2VyX2JvdW5kCiNkZWZpbmUgdWIgdXBwZXJfYm91bmQKI2RlZmluZSBhbGwoeCkgeC5iZWdpbigpLCB4LmVuZCgpCiNkZWZpbmUgc3ooeCkgeC5zaXplKCkKCmNvbnN0IGludCBOPTFlNis1Owpjb25zdCBpbnQgTk49MWUzKzk7CmNvbnN0IGludCBNT0Q9MWU5Kzc7CmNvbnN0IGludCBkeFs0XT17MCwgLTEsIDAsIDF9Owpjb25zdCBpbnQgZHlbNF09ey0xLCAwLCAxLCAwfTsKY29uc3QgaW50IElORj0xZTE4Owpjb25zdCBsZCBlcHM9MWUtNjsKY29uc3QgbGQgcGk9YWNvcygtMS4wKTsgLy8gNDggZGlnaXRzCgppbnQgbiwgaW52OwoKaW50IFBvdyhpbnQgYSwgaW50IGIpIHsKICAgIGlmIChiPT0wKSByZXR1cm4gMTsKICAgIGlmIChiPT0xKSByZXR1cm4gYTsKICAgIGludCB0bXA9UG93KGEsYi8yKSVNT0Q7CiAgICBpZiAoYiYxKSByZXR1cm4gKCgodG1wKnRtcCklTU9EKSphKSVNT0Q7CiAgICByZXR1cm4gKHRtcCp0bXApJU1PRDsKfQoKaW50IFN1bV9yYW5nZShpbnQgbikgewogICAgbiU9TU9EOwogICAgaW50IHJlcz0oKChuKihuKzEpKSVNT0QpKmludiklTU9EOwogICAgcmV0dXJuIHJlczsKfQoKaW50IFN1bShpbnQgbikgewogICAgaW50IHJlcz0wOwogICAgaW50IGw9MTsKICAgIGludCByPTE7CiAgICB3aGlsZSAobDw9bikgewogICAgICAgIGludCBzYW1lPW4vbDsKICAgICAgICByPW4vc2FtZTsKICAgICAgICBpbnQgdG1wMT0oKFN1bV9yYW5nZShyKS1TdW1fcmFuZ2UobC0xKSklTU9EK01PRCklTU9EOwogICAgICAgIGludCB0bXAyPShzYW1lKnRtcDEpJU1PRDsKICAgICAgICByZXM9KHJlcyt0bXAyKSVNT0Q7CiAgICAgICAgbD1yKzE7CiAgICB9CiAgICByZXR1cm4gcmVzOwp9Cgp2b2lkIHByb2Nlc3MoKSB7CiAgICAvLyBDb2RlIGhlcmUgOlYKICAgIGNpbj4+bjsKICAgIGludj1Qb3coMixNT0QtMik7CiAgICBjb3V0PDxTdW0obik7Cgp9CgpzaWduZWQgbWFpbigpIHsKICAgIGNpbi50aWUoMCktPnN5bmNfd2l0aF9zdGRpbygwKTsKLy8gICAgZnJlb3BlbihmaWxlIi5pbnAiLCJyIixzdGRpbik7Ci8vICAgIGZyZW9wZW4oZmlsZSIub3V0IiwidyIsc3Rkb3V0KTsKICAgIGludCB0PTE7Ci8vICAgIGNpbj4+dDsKICAgIHdoaWxlICh0LS0pIHByb2Nlc3MoKTsKICAgIHJldHVybiAwOwp9Cg==