#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000000LL //[[l,r],v] l<=x<=rは, floor(N/x)=v vector,long long>> get_floor(long long N){ vector,long long>> ret; for(long long i=1;i<=N;i++){ long long v = N/i; ret.emplace_back(make_pair(i,0),v); i = N/v; ret.back().first.second = i; } return ret; } mint i2; mint sum(long long n){ mint ret = 0; ret = n; ret *= n+1; ret *= i2; return ret; } mint sum(long long l,long long r){ if(l==0)return sum(r); return sum(r)-sum(l-1); } mint i6; mint f2(long long n){ mint ret = n; ret *= n+1; ret *= n*2+1; ret *= i6; return ret; } mint sum2(long long l,long long r){ if(l==0)return f2(r); return f2(r)-f2(l-1); } int main(){ i2 = mint(2).inv(); i6 = mint(6).inv(); long long n; cin>>n; auto fs = get_floor(n); mint ans= 0; rep(i,fs.size()){ long long L = fs[i].first.first,R = fs[i].first.second; long long v = fs[i].second; { mint tt = n; tt *= R-L+1; tt *= v; ans += tt; } { mint tt = sum(L-1,R-1); tt *= v; ans -= tt; } { mint tt = sum(v-1); tt *= sum(L,R); ans -= tt; } } cout<