N = int(input()) def inverse(n, d): return n * pow(d, -1, MOD) % MOD MOD = 998244353 P = [0, 1, inverse(1, 2), inverse(1, 3)] dp = [[0]*5 for _ in range(N)] for i in range(1, N): for j in range(5): for k in range(-1, 2): if 0 <= j+k <= 4: if 1 <= j+k <= 3: if 1 <= j <= 3: dp[i][j] += (dp[i-1][j+k]+1)*P[3]%MOD else: dp[i][j] += (dp[i-1][j+k]+1)*P[2]%MOD dp[i][j] %= MOD else: if 1 <= j <= 3: dp[i][j] += dp[i-1][j+k]*P[3]%MOD else: dp[i][j] += dp[i-1][j+k]*P[2]%MOD dp[i][j] %= MOD ans = 0 for i in range(5): if 1 <= i <= 3: ans += (dp[-1][i]+1)*inverse(1, 5)%MOD ans %= MOD else: ans += dp[-1][i]*inverse(1, 5)%MOD ans %= MOD print(ans)