{"raw_statement":[{"iden":"problem statement","content":"Given is a sequence of $N$ positive integers $A = (A_1, A_2, \\ldots, A_N)$.\nYou can do the following operation on this sequence any number of times.\n\n*   Choose integers $i, j, k$ such that $1\\leq i < j < k \\leq N$ and $j = \\frac{i+k}{2}$. Replace $A_j$ with $\\lfloor\\frac{A_i+A_k}{2}\\rfloor$.\n\nFind the minimum possible value of $\\sum_{i=1}^N A_i$ after the operations."},{"iden":"constraints","content":"*   $3\\leq N\\leq 3\\times 10^5$\n*   $1\\leq A_i\\leq 10^{12}$"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\ldots$ $A_N$"},{"iden":"sample input 1","content":"5\n2 2 5 5 4"},{"iden":"sample output 1","content":"13\n\nThe following operations achieves $\\sum_{i=1}^N A_i = 13$.\n\n*   Do the operation with $(i,j,k) = (1,3,5)$. The sequence $A$ is now $(2,2,3,5,4)$.\n*   Do the operation with $(i,j,k) = (3,4,5)$. The sequence $A$ is now $(2,2,3,3,4)$.\n*   Do the operation with $(i,j,k) = (2,3,4)$. The sequence $A$ is now $(2,2,2,3,4)$."},{"iden":"sample input 2","content":"5\n3 1 4 1 5"},{"iden":"sample output 2","content":"11"},{"iden":"sample input 3","content":"3\n3 1 3"},{"iden":"sample output 3","content":"7"},{"iden":"sample input 4","content":"3\n3 5 3"},{"iden":"sample output 4","content":"9"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}