Cheating on ICPC

Time Limit : 1 sec, Memory Limit : 65536 KB

Problem J: Cheating on ICPC

Peter loves any kinds of cheating. A week before ICPC, he broke into Doctor's PC and sneaked a look at all the problems that would be given in ICPC. He solved the problems, printed programs out, and brought into ICPC. Since electronic preparation is strictly prohibited, he had to type these programs again during the contest.

Although he believes that he can solve every problems thanks to carefully debugged programs, he still has to find an optimal strategy to make certain of his victory.

Teams are ranked by following rules.

  1. Team that solved more problems is ranked higher.
  2. In case of tie (solved same number of problems), team that received less Penalty is ranked higher.

Here, Penalty is calculated by these rules.

  1. When the team solves a problem, time that the team spent to solve it (i.e. (time of submission) - (time of beginning of the contest)) are added to penalty.
  2. For each submittion that doesn't solve a problem, 20 minutes of Penalty are added. However, if the problem wasn't solved eventually, Penalty for it is not added.

You must find that order of solving will affect result of contest. For example, there are three problem named A, B, and C, which takes 10 minutes, 20 minutes, and 30 minutes to solve, respectively. If you solve A, B, and C in this order, Penalty will be 10 + 30 + 60 = 100 minutes. However, If you do in reverse order, 30 + 50 + 60 = 140 minutes of Penalty will be given.

Peter can easily estimate time to need to solve each problem (actually it depends only on length of his program.) You, Peter's teammate, are asked to calculate minimal possible Penalty when he solve all the problems.


Input file consists of multiple datasets. The first line of a dataset is non-negative integer N (0<= N <= 100) which stands for number of problem. Next N Integers P[1], P[2], ..., P[N] (0<= P[i] <= 10800) represents time to solve problems.

Input ends with EOF.


Output minimal possible Penalty, one line for one dataset.

Sample Input

10 20 30
56 26 62 43 25 80 7

Output for the Sample Input


Source: University of Aizu Programming Contest , Aizu-Wakamatsu, Japan, 2008
(extra problem for 2008)