You are given an array
A of
N non-negative integers. You can rearrange the elements of the array in any order. The score of an arrangement is defined as:
\sum_{i=1}^{N} (A_i \cdot i)
Find the arrangement that maximizes the score and output this maximum total.
Input
The first line contains an integer N (1 \le N \le 10^5).
The second line contains N non-negative integers A_i (0 \le A_i \le 10^6).
Output
Print the maximum possible score.
Examples
| standard input | standard output |
|---|
| 3
2 2 2
| 12
|