Now you have an array A with size N(1<=N<=300000, Ai > 0 and Ai < 1000000). you can also chose two elements in A such that Ai = Aj and make them become one element with value Ai + Aj. And you should print the maximum value you can get finally. The time you use the operation is unlimited which means you can do the operation when you find two elements such that Ai = Aj.
For example, if A = {3, 1, 2, 1}, you can chose (1, 1) and make them become their sum, then A = {2, 2, 3}, then you can choose (2, 2) and get a 4, so A = {3, 4}, the max element you can get is 4.