1219: 拼数

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:8 Solved:2

Description

Input

Output

Sample Input Copy

3
5 1 2

Sample Output Copy

4

HINT

【样例输入2】 
4
3 2 1 4
【样例输出2】 
11 

【样例输入3】 

7 1 3 8
【样例输出3】 


【数据范围】 
对于50%的数据,n≤15。

对于80%的数据,n≤10000,1 ≤ ai ≤ 100000。

对于100%的数据,n≤100000,1≤ai≤109