← Back to Problems
Coupled Recurrence
Medium standard Combinatorics
Time limit: 1 s per test  ·  Memory: 256 MB

Two integer sequences are defined for n >= 1 by

a_n = 2 a_{n-1} + b_{n-1}

b_n = a_{n-1} + b_{n-1}

with a_0 = 1 and b_0 = 0.

Compute a_n modulo 998244353.

Input

One line with the integer n.

Output

a_n modulo 998244353.

Constraints

0 <= n <= 10^18

Scoring

This is a standard problem: a submission scores full points if it produces the correct output for every test case, and zero otherwise.

Examples

input
3
output
13
input
10
output
10946
Python 3.13 i Execution environment Isolated microVM · 1 vCPU · no internet access Time and memory limits are set per problem Available packages numpy 2.5.0scipy 1.18.0pandas 3.0.0scikit-learn 1.9.0statsmodels 0.15.0cvxpy 1.9.2