Stone Game
题号:NC216161
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

MianKing has piles of stones and each pile has at most stones, now he wants to merge all of these stones into one pile.

In order to achieve his goal, each time MianKing can choose two piles of stones and merge them into a new pile, and the number of stones in the new pile is the sum of these two piles. 

Because it takes manpower to move stones, in each operation if the numbers of these two piles of stones are and respectively, MianKing should pay coins for it.

Now MianKing wants to know the minimum amount of coins he need to pay to merge all of these stones into one pile.

输入描述:

The first line has  integers a_1,a_2,a_3. And a_i denotes the number of piles which have  stones.




输出描述:

Output one integer: the minimum amount of coins MianKing need to pay for his goal.
示例1

输入

复制
1 1 1

输出

复制
2
示例2

输入

复制
99 66 55

输出

复制
165