{"raw_statement":[{"iden":"problem statement","content":"Find the number of sequences of integers with $N$ terms, $A=(a_1,a_2,\\ldots,a_N)$, that satisfy the following conditions, modulo $998244353$.\n\n*   $0 \\leq a_1 \\leq a_2 \\leq \\ldots \\leq a_N \\leq M$.\n*   For each $i=1,2,\\ldots,N-1$, the remainder when $a_i$ is divided by $3$ is different from the remainder when $a_{i+1}$ is divided by $3$."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 10^7$\n*   $1 \\leq M \\leq 10^7$\n*   All values in the input are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $M$"},{"iden":"sample input 1","content":"3 4"},{"iden":"sample output 1","content":"8\n\nHere are the eight sequences that satisfy the conditions.\n\n*   $(0,1,2)$\n*   $(0,1,3)$\n*   $(0,2,3)$\n*   $(0,2,4)$\n*   $(1,2,3)$\n*   $(1,2,4)$\n*   $(1,3,4)$\n*   $(2,3,4)$"},{"iden":"sample input 2","content":"276 10000000"},{"iden":"sample output 2","content":"909213205\n\nBe sure to find the count modulo $998244353$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}