{"raw_statement":[{"iden":"problem statement","content":"$N$ bags are arranged in a row. The $i$\\-th bag contains $x_i$ yen (the currency in Japan).\nTakahashi and Aoki, who have sufficient money, take alternating turns to perform the following action:\n\n*   choose one of the following three actions and perform it.\n    *   choose the leftmost or rightmost bag and take it.\n    *   pay $A$ yen to Snuke. Then, repeat the following action $\\min(B,n)$ times (where $n$ is the number of the remaining bags): choose the leftmost or rightmost bag and take it.\n    *   pay $C$ yen to Snuke. Then, repeat the following action $\\min(D,n)$ times (where $n$ is the number of the remaining bags): choose the leftmost or rightmost bag and take it.\n\nWhen all the bags are taken, Takahashi's benefit is defined by \"(total amount of money in the bags that Takahashi took) - (total amount of money that Takahashi paid to snuke)\"; let this amount be $X$ yen. We similarly define Aoki's benefit, denoting the amount by $Y$ yen.\nFind $X-Y$ if Takahashi and Aoki make optimal moves to respectively maximize and minimize $X-Y$."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 3000$\n*   $1 \\leq x_i \\leq 10^9$\n*   $1 \\leq A,C \\leq 10^9$\n*   $1 \\leq B,D \\leq N$\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$ $A$ $B$ $C$ $D$\n$x_1$ $x_2$ $\\ldots$ $x_N$"},{"iden":"sample input 1","content":"5 10 2 1000000000 1\n1 100 1 1 1"},{"iden":"sample output 1","content":"90\n\nIf Takahashi and Aoki make optimal moves, it ends up being $X=92$ and $Y=2$."},{"iden":"sample input 2","content":"10 45 3 55 4\n5 10 15 20 25 30 35 40 45 50"},{"iden":"sample output 2","content":"85"},{"iden":"sample input 3","content":"15 796265 10 165794055 1\n18804175 185937909 1934689 18341 68370722 1653 1 2514380 31381214 905 754483 11 5877098 232 31600"},{"iden":"sample output 3","content":"302361955"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}