Processing math: 100%
Maximum value arrangement - MarisaOJ: Marisa Online Judge

Maximum value arrangement

Time limit: 1000 ms
Memory limit: 256 MB

Given an array $A$ of $n$ positive integers, the task is to rearrange the elements of $A$ in any order and merge them into a single integer. For example, merging the array $A = \{23, 12, 6\}$ would result in the integer $23126$. The goal is to determine the maximum value that can be achieved through this merging process.

Input

  • The first line contains an integer $n$.
  • The second line contains $n$ integer $A_i$.

Output

  • The maximum value you can achieve.

Constraints

  • $1 \le n \le 10^5$.
  • $1 \le A_i \le 10^9$.

Example

Input:

3
23 12 6

Output:

62312

Note: arrange elements as $\{6,23,12\}$.