#include using namespace std; typedef long long ll; ll mod = 998244353; ll pw(ll a,ll x){ ll ret = 1; while(x){ if(x&1) (ret *= a) %= mod; (a *= a) %= mod; x /= 2; } return ret; } ll gcd(ll a,ll b){ if(a> n; for(i=1;i<=n;i++) moe[i] = 1; for(i=2;i<=n;i++){ if(p[i]!=0) continue; moe[i] = -1; for(j=2;i*j<=n;j++){ p[i*j] = i; if(j%i==0) moe[i*j] = 0; else moe[i*j] *= -1; } } for(i=2;i<=n;i++){ if(moe[i]<0) moe[i] = mod - 1; } for(i=1;i<=n;i++) f[i] = pw(2,n/i)*moe[i]%mod; ll ans = 0,sum1 = 0,sum2 = 0; for(i=1;i<=n;i++) (sum1 += moe[i]) %= mod; for(i=1;i<=n;i++) (sum2 += f[i]) %= mod; (ans += sum1*sum1) %= mod; (ans += mod - (2*sum1*sum2)%mod) %= mod; /*for(i=1;i<=n;i++){ for(j=1;j<=n;j++){ ll d = lcm(i,j); int c1 = n/i - n/d,c2 = n/j - n/d,c3 = n/d; ll num = pw(2,c1 + c2)*pw(3,c3)%mod; (num *= moe[i]*moe[j]%mod) %= mod; (ans += num) %= mod; } } cout << ans << endl; return 0;*/ //kokomade atteru /*for(i=1;i<=n;i++){ for(j=1;j<=n;j++){ (g[lcm(i,j)] += f[i]*f[j]%mod) %= mod; } }*/ /*for(i=1;i<=n;i++) cout << f[i] << " "; cout << endl;*/ for(i=n;i>=1;i--){ for(j=2*i;j<=n;j+=i){ (f[j] += f[i]) %= mod; } } for(i=1;i<=n;i++) (f[i] *= f[i]) %= mod; for(i=1;i<=n;i++){ for(j=2*i;j<=n;j+=i){ (f[j] += mod - f[i]) %= mod; } } /*for(i=1;i<=n;i++) cout << f[i] << " "; cout << endl; for(i=1;i<=n;i++) cout << g[i] << " "; cout << endl; return 0;*/ (sum2 *= sum2) %= mod; ll p = pw(4,mod - 2)*3%mod;//p = 3/4 for(i=1;i<=n;i++) (sum2 += mod - f[i]) %= mod; (ans += sum2) %= mod; for(i=1;i<=n;i++){ (ans += f[i]*pw(p,n/i)%mod) %= mod; } cout << ans << endl; }