#t355. 拼数

拼数

Splicing Numbers

Problem Description

Given nn positive integers a1…ana_1 \dots a_n, concatenate them into a single row, joining adjacent numbers head-to-tail, to form the largest possible integer.

Input Format

The first line has an integer, the number of integers nn.

The second line has nn integers, the given integers aia_i.

Output Format

A positive integer, the largest possible integer.

Sample Input

3
13 312 343

Sample Output

34331213

Sample Input 2

4
7 13 4 246

Sample Output 2

7424613

Hint

For all test cases, it is guaranteed that 1≤n≤201 \le n \le 20, 1≤ai≤1091 \le a_i \le 10^9.

NOIP 1998 Advanced Group, Problem 2.