#include #include using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) #define all(x) begin(x), end(x) template bool chmin(T& x, T y) { return x > y ? (x = y, true) : false; } template bool chmax(T& x, T y) { return x < y ? (x = y, true) : false; } struct io_setup { io_setup() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); } } io_setup; using mint = atcoder::modint998244353; mint greedy(ll x) { mint ans = 0; rep(i, 1, x + 1) { ans += mint(x / i).pow(i); } return ans; } void solve() { ll x; cin >> x; mint ans = 0; for (ll i = 1; i * i <= x; i++) { ans += mint(x / i).pow(i); } ll r = x + 1; for (ll d = 1; d < x / d; d++) { ll l = x / (d + 1) + 1; if (d == 1) ans += r - l; else { ans += mint(d).pow(l) * (mint(d).pow(r - l) - 1) / (mint(d) - 1); } r = l; } cout << ans.val(); } int main() { int t = 1; // cin >> t; while (t--) solve(); }