{"problem":{"name":"Serval Survival","description":{"content":"There are $N$ servals on a bridge of length $L$. The $i$\\-th serval is located at position $A_{i}$ from the left end of the bridge. Here, $0 < A_{1} < A_{2} < \\cdots < A_{N} < L$ holds. For each $i = ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc178_e"},"statements":[{"statement_type":"Markdown","content":"There are $N$ servals on a bridge of length $L$.\nThe $i$\\-th serval is located at position $A_{i}$ from the left end of the bridge.\nHere, $0 < A_{1} < A_{2} < \\cdots < A_{N} < L$ holds.\nFor each $i = 1, 2, \\dots, N$, answer the following question:\n\n> The servals will perform the following three actions in order:\n> \n> *   Action $1$: The $N - 1$ servals other than the $i$\\-th serval face left or right.\n> *   Action $2$: The $i$\\-th serval faces left or right.\n> *   Action $3$: All servals start moving simultaneously. All servals move at a constant speed of exactly $1$ unit distance per unit time. When a serval reaches the end of the bridge, it leaves the bridge. If two servals collide, they both reverse their direction and continue moving.\n> \n> The $i$\\-th serval is smart and loves this bridge, so when choosing a direction in Action $2$, it will observe the directions of the other $N-1$ servals and choose the direction that allows it to stay on the bridge the longer during Action $3$. There are $2^{N-1}$ possible combinations of directions for the $N-1$ servals in Action $1$. Find the sum, modulo $998244353$, over all these combinations, of the durations the $i$\\-th serval can stay on the bridge. It can be proved that the output value is an integer.\n\n## Constraints\n\n*   $1 \\leq N \\leq 10^{5}$\n*   $0 < A_{1} < A_{2} < \\cdots < A_{N} < L \\leq 10^{9}$\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $L$\n$A_{1}$ $A_{2}$ $\\cdots$ $A_{N}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc178_e","tags":[],"sample_group":[["2 167\n9 24","182\n301\n\nFor $i = 1$, it is always optimal to face right.\nFor $i = 2$, it is optimal to face the opposite direction from the first serval."],["1 924\n167","757"],["10 924924167\n46001560 235529797 272749755 301863061 359726177 470023587 667800476 696193062 741860924 809211293","112048251\n409175578\n167800512\n997730745\n278651538\n581491882\n884751575\n570877705\n747965896\n80750577"]],"created_at":"2026-03-03 11:01:13"}}