Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/saralash-eng-katta-son-tuzish

Largest number

Medium 1000 ms 128 MB 60%
Share

$n$ non-negative integers are given. They are written (glued) one after another in some order, forming one number. Print the largest number that can be formed. For example, $3, 30, 34, 5, 9$ give $9534330$. Print the answer without unnecessary leading zeros.

Numbers on cards glued in the order that gives the largest number

Input

The first line contains a positive integer $n$. The second line contains $n$ integers $a_{i}$ separated by spaces.

Output

One number — the largest number that can be formed.

Note

$1 \le n \le 10^{5}$
$0 \le a_{i} \le 10^{9}$
the numbers have no unnecessary leading zeros

Examples

Input #1
5
3 30 34 5 9
Output #1
9534330
Input #2
2
0 0
Output #2
0

Sign in to submit a solution

Signing up is free and takes a minute.