Problem: Problem Statement
As they say, small is cute and beautiful.

Given N distinct positive integers, find the smallest number that can be formed by concatenating all of them.
Input Format
The first line of the input file contains a positive integer N. Then N lines follow.
Each line contains a single positive integer K.

Output Format
Output the smallest possible number that can be formed by concatenating all the numbers.

Constraints
1 ≤ N ≤ 5000
1 ≤ K ≤ 10^15

SAMPLE INPUT
5
14
66
907
1234567890
9876543210

SAMPLE OUTPUT
123456789014669079876543210

Solution (in PYTHON):

Solution:
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
def func(a,b):
        if(len(a) != len(b)):
                #a = int(a)
                #b = int(b)
                str1 = a + b   
                str2 = b + a
                if str1 > str2:
                        return 1
                elif str1 == str2:
                        return 0
                else:
                        return -1
        else:
                if a > b:
                        return 1
                elif a==b:
                        return 0
                else:
                        return -1
lines = int(raw_input())
lst = []
for i in range(lines):
	lst.append(raw_input())
lst.sort(func)
res = ""
for i in lst:
	res = res + i
print(int(res))