n%i=n-[n/i]*i
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;
typedef long long ll;
int P=1000000007;
int INV=5e8+4;
ll n;
ll Ans=0;
inline ll Sum(ll l,ll r){
return ((l+r)%P)*((r-l+1)%P)%P*INV%P;
}
int main(){
scanf("%lld",&n);
Ans=(n%P)*(n%P)%P;
for (ll i=1,last;i<=n;i=last+1){
last=n/(n/i);
Ans+=P-(ll)(n/i)*Sum(i,last)%P;
Ans%=P;
}
printf("%lld\n",Ans);
return 0;
}