#include #define rep(i, p, n) for (ll i = p; i < (ll)(n); i++) #define rep2(i, p, n) for (ll i = p; i >= (ll)(n); i--) using namespace std; using ll = long long; using ld = long double; const double pi = 3.141592653589793; const long long inf = 2 * 1e9; const long long linf = 4 * 1e18; const ll mod1 = 1000000007; const ll mod2 = 998244353; template inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } // atcoder #include using namespace atcoder; using mint1 = modint1000000007; using mint2 = modint998244353; vector> base = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; //素数列挙 //output: (void)N以下の整数のうち素数であるものをsosuuに返す void SR(ll N, vector &sosuu) { vector testSR(N+1, true); for(int i=2; i<=N; i++) { if (testSR.at(i)) { sosuu.push_back(i); for(int j=i*2; j<=N; j+=i) { testSR.at(j)=false; } } } } int main() { ////////////////// ios::sync_with_stdio(false); cin.tie(nullptr); ////////////////// ll N; cin >> N; vector sosuu(0); SR(N, sosuu); ll M = sosuu.size(); vector co(M); ll now = 0; for (ll c : sosuu) { //N!中の素因数cの個数 ll temp = N; while(temp!=0) { co.at(now) += temp / c; temp /= c; } now++; } vector li(M, 1); vector> kake(2000000); rep(i, 0, M) { rep(j, 0, co.at(i)) { kake.at(co.at(i)/(j+1)).push_back(i); //cout << co.at(i)/(j+1) << " " << i << endl; } } mint2 ans = 0, now2=1, B=1; rep2(i, 1999999, 0) { for(ll c:kake.at(i)) { now2 /= li.at(c); li.at(c)++; now2 *= li.at(c); } ans += (now2-B) * i; B=now2; } cout << ans.val(); }