#nullable enable #region var (_input, _iter) = (Array.Empty(), 0); T I() where T : IParsable { while (_iter >= _input.Length) (_input, _iter) = (Console.ReadLine()!.Split(' '), 0); return T.Parse(_input[_iter++], null); } #endregion var n = I(); var s = 1L; while (s * s <= n) s++; s--; ModInt ans = 0; var last = n; ModInt S(long i, ModInt k) { if (k == 1) return i + 1; return (1 - k.Power(i + 1)) / (1 - k); } for (var i = 1; i <= s; i++) { var j = n / (i + 1); ans += S(last, i) - S(j, i); last = j; } for (var i = 1; i <= n; i++) { var j = n / i; if (j <= s) break; ans += ((ModInt)j).Power(i); } Console.WriteLine(ans); readonly record struct ModInt { public const int Mod = 998244353; int V { get; init; } public ModInt(long value) { var v = value % Mod; if (v < 0) v += Mod; V = (int)v; } static ModInt New(int value) => new(){ V = value }; public static implicit operator ModInt(long v) => new(v); public static implicit operator int(ModInt modInt) => modInt.V; public static ModInt AdditiveIdentity => New(0); public static ModInt operator +(ModInt a, ModInt b) { var v = a.V + b.V; if (v >= Mod) v -= Mod; return New(v); } public ModInt AdditiveInverse() { if (V == 0) return AdditiveIdentity; return New(Mod - V); } public static ModInt operator -(ModInt a, ModInt b) { var v = a.V - b.V; if (v < 0) v += Mod; return New(v); } public static ModInt MultiplicativeIdentity => New(1); public static ModInt operator *(ModInt a, ModInt b) => New((int)((long)a.V * b.V % Mod)); public ModInt MultiplicativeInverse() => V == 0 ? throw new DivideByZeroException() : Power(V, Mod - 2, Mod); public static ModInt operator /(ModInt a, ModInt b) => a * b.MultiplicativeInverse(); static long Power(long v, ulong p, long mod) { var (res, k) = (1L, v); while (p > 0) { if ((p & 1) > 0) res = res * k % mod; k = k * k % mod; p >>= 1; } return res; } public ModInt Power(long p) => p < 0 ? MultiplicativeInverse().Power(-p) : Power(V, (ulong)p, Mod); public override string ToString() => V.ToString(); }