#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using Int = long long; template ostream &operator<<(ostream &os, const pair &a) { return os << "(" << a.first << ", " << a.second << ")"; }; template void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; } template bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; } template bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; } //////////////////////////////////////////////////////////////////////////////// template struct ModInt { static constexpr unsigned M = M_; unsigned x; constexpr ModInt() : x(0U) {} constexpr ModInt(unsigned x_) : x(x_ % M) {} constexpr ModInt(unsigned long long x_) : x(x_ % M) {} constexpr ModInt(int x_) : x(((x_ %= static_cast(M)) < 0) ? (x_ + static_cast(M)) : x_) {} constexpr ModInt(long long x_) : x(((x_ %= static_cast(M)) < 0) ? (x_ + static_cast(M)) : x_) {} ModInt &operator+=(const ModInt &a) { x = ((x += a.x) >= M) ? (x - M) : x; return *this; } ModInt &operator-=(const ModInt &a) { x = ((x -= a.x) >= M) ? (x + M) : x; return *this; } ModInt &operator*=(const ModInt &a) { x = (static_cast(x) * a.x) % M; return *this; } ModInt &operator/=(const ModInt &a) { return (*this *= a.inv()); } ModInt pow(long long e) const { if (e < 0) return inv().pow(-e); ModInt a = *this, b = 1U; for (; e; e >>= 1) { if (e & 1) b *= a; a *= a; } return b; } ModInt inv() const { unsigned a = M, b = x; int y = 0, z = 1; for (; b; ) { const unsigned q = a / b; const unsigned c = a - q * b; a = b; b = c; const int w = y - static_cast(q) * z; y = z; z = w; } assert(a == 1U); return ModInt(y); } ModInt operator+() const { return *this; } ModInt operator-() const { ModInt a; a.x = x ? (M - x) : 0U; return a; } ModInt operator+(const ModInt &a) const { return (ModInt(*this) += a); } ModInt operator-(const ModInt &a) const { return (ModInt(*this) -= a); } ModInt operator*(const ModInt &a) const { return (ModInt(*this) *= a); } ModInt operator/(const ModInt &a) const { return (ModInt(*this) /= a); } template friend ModInt operator+(T a, const ModInt &b) { return (ModInt(a) += b); } template friend ModInt operator-(T a, const ModInt &b) { return (ModInt(a) -= b); } template friend ModInt operator*(T a, const ModInt &b) { return (ModInt(a) *= b); } template friend ModInt operator/(T a, const ModInt &b) { return (ModInt(a) /= b); } explicit operator bool() const { return x; } bool operator==(const ModInt &a) const { return (x == a.x); } bool operator!=(const ModInt &a) const { return (x != a.x); } friend std::ostream &operator<<(std::ostream &os, const ModInt &a) { return os << a.x; } }; //////////////////////////////////////////////////////////////////////////////// constexpr unsigned MO = 998244353; using Mint = ModInt; // floor(sqrt(a)) long long floorSqrt(long long a) { long long b = a, x = 0, y = 0; for (int e = (63 - __builtin_clzll(a)) & ~1; e >= 0; e -= 2) { x <<= 1; y <<= 1; if (b >= (y | 1) << e) { b -= (y | 1) << e; x |= 1; y += 2; } } return x; } constexpr int LIM = 320'000; Int N, sqrtN; bool isPrime[LIM]; int primesLen; Int primes[LIM]; Mint small[LIM], large[LIM]; Mint get(Int n) { return (n <= sqrtN) ? small[n] : large[N / n]; } void primeSum0() { sqrtN = floorSqrt(N); fill(isPrime + 2, isPrime + (sqrtN + 1), true); primesLen = 0; fill(small, small + (sqrtN + 1), 0); fill(large, large + (sqrtN + 1), 0); for (Int n = 1; n <= sqrtN; ++n) small[n] = n; for (Int l = 1; l <= sqrtN; ++l) large[l] = N / l; for (Int p = 2; p <= sqrtN; ++p) if (isPrime[p]) { primes[primesLen++] = p; for (Int n = p * p; n <= sqrtN; n += p) isPrime[n] = false; for (Int l = 1; l <= sqrtN; ++l) { const Int n = N / l; if (n < p * p) break; large[l] -= (get(n / p) - small[p - 1]); } for (Int n = sqrtN; n >= 1; --n) { if (n < p * p) break; small[n] -= (get(n / p) - small[p - 1]); } } for (Int n = 1; n <= sqrtN; ++n) small[n] -= 1; for (Int l = 1; l <= sqrtN; ++l) large[l] -= 1; } constexpr int E = 40; Int K; Mint pw[E]; Mint ans; void dfs(int pos, Int n, Mint val, int e) { if (pos >= 0) { ans += (val * pw[e + 1]); const Int nn = n / primes[pos]; if (nn >= primes[pos]) { dfs(pos, nn, val, e + 1); } } ans += (get(n) - pos - 1) * (val * pw[e] * pw[1]); for (int i = pos + 1; i < primesLen; ++i) { const Int nn = n / primes[i]; if (nn < primes[i]) { break; } dfs(i, nn, val * pw[e], 1); } } int main() { for (; ~scanf("%lld%lld", &K, &N); ) { primeSum0(); for (int e = 0; e < E; ++e) { pw[e] = Mint(e + 1).pow(K); } ans = 1; dfs(-1, N, 1, 0); printf("%u\n", ans.x); fflush(stdout); } return 0; }