#include void func (long long n, long long mod_num, long long *dp) { long long tmp[4] = {}; if (n == 1LL) { dp[0] = 0LL; dp[1] = 0LL; dp[2] = 0LL; dp[3] = 1LL; return; } func(n/2LL, mod_num, dp); tmp[0] = 2LL*(dp[0]+dp[2])%mod_num; tmp[1] = (dp[1]+dp[3])%mod_num; tmp[0] += (dp[0]*(dp[0]+dp[2]))%mod_num; tmp[0] += (dp[1]*dp[0])%mod_num; tmp[1] += (dp[0]*(dp[1]+dp[3]))%mod_num; tmp[1] += (dp[1]*dp[1])%mod_num; tmp[2] = (dp[2]+dp[3])%mod_num; tmp[2] += (dp[2]*(dp[0]+dp[2]))%mod_num; tmp[2] += (dp[3]*dp[0])%mod_num; tmp[3] = (dp[2]*(dp[1]+dp[3]))%mod_num; tmp[3] += (dp[3]*dp[1])%mod_num; if (n%2LL == 1LL) { dp[0] = (tmp[0]+tmp[1])%mod_num; dp[1] = (1LL+tmp[0])%mod_num; dp[2] = (tmp[2]+tmp[3])%mod_num; dp[3] = tmp[2]%mod_num; } else { dp[0] = tmp[0]%mod_num; dp[1] = tmp[1]%mod_num; dp[2] = tmp[2]%mod_num; dp[3] = tmp[3]%mod_num; } //printf("%lld %lld %lld %lld %lld\n", n, dp[0], dp[1], dp[2], dp[3]); return; } int main () { long long n = 0LL; int res = 0; long long ans = 0LL; long long mod_num = 998244353LL; long long dp[4] = {}; res = scanf("%lld", &n); func(n, mod_num, dp); ans = (dp[0]+dp[1])%mod_num; printf("%lld\n", ans); return 0; }