mod = 998244353 n = int(input()) ans = (1-pow(pow(-3,mod-2,mod),n,mod))*(mod+1)//2%mod print(ans)