#pragma GCC optimize("O3") #include #define ll long long #define rep(i,n) for(ll i=0;i<(n);i++) #define pll pair #define pii pair #define pq priority_queue #define pb push_back #define eb emplace_back #define fi first #define se second #define endl '\n' #define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define lb(c,x) distance(c.begin(),lower_bound(all(c),x)) #define ub(c,x) distance(c.begin(),upper_bound(all(c),x)) using namespace std; const ll INF=1e9; const ll mod = 1e9+7; struct mint { ll x; // typedef long long ll; mint(ll x=0):x((x%mod+mod)%mod){} mint operator-() const { return mint(-x);} mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; } mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;} mint operator+(const mint a) const { return mint(*this) += a;} mint operator-(const mint a) const { return mint(*this) -= a;} mint operator*(const mint a) const { return mint(*this) *= a;} mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod-2);} mint& operator/=(const mint a) { return *this *= a.inv();} mint operator/(const mint a) const { return mint(*this) /= a;} }; istream& operator>>(istream& is, mint& a) { return is >> a.x;} ostream& operator<<(ostream& os, const mint& a) { return os << a.x;} // combination mod prime // https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619 struct combination { vector fact, ifact; combination(ll n):fact(n+1),ifact(n+1) { assert(n < mod); fact[0] = 1; for (ll i = 1; i <= n; ++i) fact[i] = fact[i-1]*i; ifact[n] = fact[n].inv(); for (ll i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i; } mint operator()(ll n, ll k) { if (k < 0 || k > n) return 0; return fact[n]*ifact[k]*ifact[n-k]; } mint p(ll n, ll k) { return fact[n]*ifact[n-k]; } } c(1000005); int main(){ ll n; cin >> n; mint ans=0; ll mx=1; for(ll i=2;i*i<=n;i++){ mx=i; } for(ll i=2;i*i<=n;i++){ ll cnt=0; ll v=1; while(v<=n){ v*=i; cnt++; } vector p(cnt); ll val=1; rep(j,cnt){ p[j]=val; val*=i; } ll s=n; cnt--; while(s){ ll m=s/p[cnt]; ans+=m; s%=p[cnt]; cnt--; } } ll a=n/(mx+1); ll b=n%(mx+1); ll x=mx; ll y=0; for(ll i=a;i>=1;i--){ ll t=n/(x+1); ll u=n%(x+1); x=n/i; y=n%i; ll cnt=(u-y)/i; mint c=i; c*=cnt+1; ans+=c; mint d=i; d*=cnt; d*=cnt+1; d/=2; ans+=d; mint r=y; r*=cnt+1; ans+=r; //cout << t << " " << u << " " << x << " " << y << endl; } cout << ans << endl; return 0; }