{"raw_statement":[{"iden":"problem statement","content":"Given is a sequence $A$ of $N$ integers. There are $2^N - 1$ non-empty subsequences $B$ of $A$. Find the sum of $\\max\\left(B\\right) \\times \\min\\left(B\\right)$ over all of them.\nSince the answer can be enormous, report it modulo $998244353$."},{"iden":"constraints","content":"*   All values in input are integers.\n*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $0 \\leq A_i \\leq 998244352$"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\cdots$ $A_N$"},{"iden":"sample input 1","content":"3\n2 4 3"},{"iden":"sample output 1","content":"63\n\nThere are $7$ subsequences $B$, as follows:\n\n*   $B = \\left(2\\right)$ : $\\max\\left(B\\right) \\times \\min\\left(B\\right) = 4$\n*   $B = \\left(4\\right)$ : $\\max\\left(B\\right) \\times \\min\\left(B\\right) = 16$\n*   $B = \\left(3\\right)$ : $\\max\\left(B\\right) \\times \\min\\left(B\\right) = 9$\n*   $B = \\left(2, 4\\right)$ : $\\max\\left(B\\right) \\times \\min\\left(B\\right) = 8$\n*   $B = \\left(2, 3\\right)$ : $\\max\\left(B\\right) \\times \\min\\left(B\\right) = 6$\n*   $B = \\left(4, 3\\right)$ : $\\max\\left(B\\right) \\times \\min\\left(B\\right) = 12$\n*   $B = \\left(2, 4, 3\\right)$ : $\\max\\left(B\\right) \\times \\min\\left(B\\right) = 8$\n\nThe answer is the sum of them: $63$."},{"iden":"sample input 2","content":"1\n10"},{"iden":"sample output 2","content":"100"},{"iden":"sample input 3","content":"7\n853983 14095 543053 143209 4324 524361 45154"},{"iden":"sample output 3","content":"206521341"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}