#P414. 【例71.3】 拼最大整数

【例71.3】 拼最大整数

Description

Given nn positive integers (n<20n < 20), connect them together to form the largest possible multi-digit integer.
For example: when n=3n=3, the three integers 1313, 312312, 343343 can be connected to form the largest integer: 3433121334331213.
Another example: when n=4n=4, the four integers 77, 1313, 44, 246246 can be connected to form the largest integer: 74246137424613.

Input Format

The first line contains a positive integer nn.
The second line contains nn positive integers.

Output Format

A positive integer representing the largest possible integer that can be formed.

Sample

3
13 312 343
34331213