{"raw_statement":[{"iden":"problem statement","content":"You are given an integer sequence $A=(A_1,A_2,\\ldots,A_N)$. Also, you are given positive integers $a,b,s,t$. It is guaranteed that $a$ and $b$ are **coprime**.\nYou can perform the following four types of operations on $A$:\n\n*   Choose an integer $i$ satisfying $1\\leq i\\leq N$ and add $a$ to $A_i$. This operation costs $s$.\n*   Choose an integer $i$ satisfying $1\\leq i\\leq N$ and subtract $a$ from $A_i$. This operation costs $s$.\n*   Choose an integer $i$ satisfying $1\\leq i\\leq N$ and add $b$ to $A_i$. This operation costs $t$.\n*   Choose an integer $i$ satisfying $1\\leq i\\leq N$ and subtract $b$ from $A_i$. This operation costs $t$.\n\nAnswer $Q$ queries. In the $q$\\-th query, you are given an integer $B_q$, so find the following value modulo $998244353$:\n\n*   The minimum total cost required to make $A_{1}=A_{2}=\\cdots=A_{N}=B_q$ hold. It can be proved that it is possible to make $A_{1}=A_{2}=\\cdots=A_{N}=B_q$ hold."},{"iden":"constraints","content":"*   $1\\leq N\\leq 2\\times 10^5$\n*   $1\\leq Q\\leq 2\\times 10^5$\n*   $1\\leq a,b,s,t\\leq 5\\times 10^8$\n*   $a$ and $b$ are coprime.\n*   $1\\leq A_i\\leq 5\\times 10^8$\n*   $1\\leq B_q\\leq 5\\times 10^8$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $Q$\n$a$ $b$ $s$ $t$\n$A_1$ $A_2$ $\\ldots$ $A_N$\n$B_1$ $B_2$ $\\ldots$ $B_Q$"},{"iden":"sample input 1","content":"1 5\n3 5 4 3\n3\n1 2 3 4 5"},{"iden":"sample output 1","content":"7 11 0 11 7\n\n*   By performing operations $+a$, $-b$ on $A_1$ in order, we can make $A=(1)$. The total cost is $4+3=7$.\n*   By performing operations $-a$, $-a$, $+b$ on $A_1$ in order, we can make $A=(2)$. The total cost is $4+4+3=11$.\n*   $A=(3)$ from the beginning. The total cost is $0$.\n*   By performing operations $+a$, $+a$, $-b$ on $A_1$ in order, we can make $A=(4)$. The total cost is $4+4+3=11$.\n*   By performing operations $-a$, $+b$ on $A_1$ in order, we can make $A=(5)$. The total cost is $4+3=7$."},{"iden":"sample input 2","content":"3 1\n3 5 4 3\n1 2 3\n4"},{"iden":"sample output 2","content":"22\n\n*   By performing operations $+a$ on $A_1$, $+b$, $-a$ on $A_2$, and $+a,+a,-b$ on $A_3$ in order, we can make $A=(4,4,4)$. The total cost is $22$."},{"iden":"sample input 3","content":"5 5\n1234 4321 5 5\n1 10 100 1000 10000\n123 4567 89012345 6 789"},{"iden":"sample output 3","content":"45340 42530 531725 35135 41690"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}