{"raw_statement":[{"iden":"problem statement","content":"Given are integers $N$, $M$, $V$, and $A$. Consider the following procedure.\n\n*   Choose a sequence of $N$ integers between $1$ and $V$ (inclusive): $x=(x_1,x_2,\\cdots,x_N)$.\n*   Choose a sequence of $M$ integers between $1$ and $V$ (inclusive): $y=(y_1,y_2,\\cdots,y_M)$.\n*   Let $a$ be a variable and initialize it with $a=A$.\n*   For each $i=0,1,\\cdots,N \\times M-1$, do the following.\n    *   Replace the value of $a$ with the median of $a,x_{(i \\bmod N)+1},y_{(i \\bmod M)+1}$.\n*   Print the final value of $a$.\n\nConsider doing this procedure with every possible pair of sequences $x,y$. Find the sum of the values that will be printed, modulo $998244353$."},{"iden":"constraints","content":"*   $1 \\leq N,M \\leq 200000$\n*   $1 \\leq A \\leq V \\leq 200000$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$ $V$ $A$"},{"iden":"sample input 1","content":"2 1 2 1"},{"iden":"sample output 1","content":"11\n\nFor example, when $x=(1,2),y=(2)$, the procedure goes as follows.\n\n*   Initialize $a$ with $a=1$.\n*   For $i=1$: replace the value of $a$ with the median of $a(=1),x_1(=1),y_1(=2)$, which is $1$.\n*   For $i=2$: replace the value of $a$ with the median of $a(=1),x_2(=2),y_1(=2)$, which is $2$.\n*   Print $a(=2)$.\n\nThere are three cases where $2$ will be printed: $(x=(1,2),y=(2))$, $(x=(2,1),y=(2))$, $(x=(2,2),y=(2))$. In the other five cases, $1$ will be printed. Therefore, the answer is $2 \\times 3 + 1\\times 5=11$."},{"iden":"sample input 2","content":"2 2 5 4"},{"iden":"sample output 2","content":"2019"},{"iden":"sample input 3","content":"2100 2300 2201 2022"},{"iden":"sample output 3","content":"407723438"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}