{"problem":{"name":"A xor B plus C","description":{"content":"You are given non-negative integers $A$, $B$, and $C$. Define a sequence of non-negative integers $X = (X_1, X_2, \\dots)$ as follows: *   $X_1 = A$ *   $X_2 = B$ *   $X_{i+2} = (X_i \\oplus X_{i+1}) +","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":8000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"ttpc2024_1_d"},"statements":[{"statement_type":"Markdown","content":"You are given non-negative integers $A$, $B$, and $C$. Define a sequence of non-negative integers $X = (X_1, X_2, \\dots)$ as follows:\n\n*   $X_1 = A$\n*   $X_2 = B$\n*   $X_{i+2} = (X_i \\oplus X_{i+1}) + C\\ \\ (i=1,2,\\dots)$\n\nHere, $\\oplus$ represents the bitwise XOR operation.\nYou are also given a positive integer $N$. Calculate $X_N \\bmod 998244353$.\n\n## Constraints\n\n*   All input values are integers.\n*   $0 \\leq A, B, C < 2^{20}$\n*   $1 \\leq N \\leq 10^{18}$\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$A$ $B$ $C$ $N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"ttpc2024_1_d","tags":[],"sample_group":[["1 2 3 4","7\n\n$X = (1, 2, 6, 7, \\dots)$. Here, $X_4 = 7$ is the answer."],["123 456 789 123456789","567982455"],["0 0 0 1000000000000000000","0"]],"created_at":"2026-03-03 11:01:14"}}