Problem3004--粉碎数字

3004: 粉碎数字

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MiB

Description

小鱼同学得到了 lns="http://www.w3.org/1998/Math/MathML">n 个数字,他想知道,如果把这 lns="http://www.w3.org/1998/Math/MathML">n 个数字扔到粉碎机粉碎一下,能组成的最大数是多少?小鱼的同学们完全不明白粉碎机怎样粉碎数字,小鱼就数字粉碎做了一个定义:把数字完全打碎,比如有 lns="http://www.w3.org/1998/Math/MathML">2 个数 lns="http://www.w3.org/1998/Math/MathML">198 和 lns="http://www.w3.org/1998/Math/MathML">63 ,那么粉碎后有数字 lns="http://www.w3.org/1998/Math/MathML">1、9、8、6、3 ,那么能够组成的最大数就是 lns="http://www.w3.org/1998/Math/MathML">98631 。请你编写程序,帮助小鱼同学实现这个奇特的想法。

Input

第一行是一个整数 lns="http://www.w3.org/1998/Math/MathML">n ( lns="http://www.w3.org/1998/Math/MathML">n 是 lns="http://www.w3.org/1998/Math/MathML">1 \sim 1000 之间的整数)。

第二行有 lns="http://www.w3.org/1998/Math/MathML">n 个整数(每个整数都是 lns="http://www.w3.org/1998/Math/MathML">0 \sim 9999 之间的整数)。

Output

 个整数粉碎后能够组成的最大的整数。

Sample Input Copy

8
1 89 654 750 4687 23 90 100 

Sample Output Copy

99887766554432110000

Source/Category