#K14591. Maximum Smallest Marble Size

    ID: 24168 Type: Default 1000ms 256MiB

Maximum Smallest Marble Size

Maximum Smallest Marble Size

You are given n marbles with given sizes. In one merge operation, you can combine any two marbles into a single marble with a size equal to the sum of their sizes. You can perform an arbitrary number of merge operations. The goal is to maximize the size of the smallest marble that remains.

It turns out that by merging all the marbles into one, the size of that marble will be the sum of the sizes of all original marbles. Formally, if the sizes are \(a_1, a_2, \dots, a_n\), the answer is:

[ S = \sum_{i=1}^{n} a_i ]

Your task is to compute \(S\) given the list of marble sizes.

inputFormat

The first line contains an integer n, representing the number of marbles. The second line contains n space-separated integers, where the \(i^{th}\) integer represents the size of the \(i^{th}\) marble.

outputFormat

Output a single integer, the maximum possible size of the smallest marble, which is the sum of all the given sizes.

## sample
4
1 2 3 4
10