n=int(input()) M=998244353 a=0 i=1 while i<=n: v=n//i ni=n//v+1 a+=pow(v,i,M)*(pow(v,ni-i,M)-1)*pow(v-1,M-2,M) if v>1 else ni-i a%=M i=ni print(a)