시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 123 41 30 38.462%

문제

서로 다른 자연수 n개 a1, a2, ..., an이 주어진다. 이때, a1, ... an에서 2개를 선택해서 붙여서 새로운 수를 만들 수 있다. 이때, 가장 세 번째로 작은 수를 구하는 프로그램을 작성하시오.

예를 들어, 3과 4를 합치면 34나 43이 된다. 또, a1 = 1, a4 = 11을 합쳐서 111을 만든 경우에, a1a4와 a4a1은 다른 수이다.

입력

첫째 줄에 수의 개수 n(3 ≤ n ≤ 108)이 주어진다. 다음 줄부터 한 줄에 하나씩 ai가 주어진다. (1 ≤ ai ≤ 10000)

출력

세 번째로 작은 수를 출력한다.

예제 입력 1

3
2
7
5

예제 출력 1

52
W3sicHJvYmxlbV9pZCI6IjU2MTkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWMxMzggXHViYzg4XHVjOWY4IiwiZGVzY3JpcHRpb24iOiI8cD5cdWMxMWNcdWI4NWMgXHViMmU0XHViOTc4IFx1Yzc5MFx1YzVmMFx1YzIxOCBuXHVhYzFjIGE8c3ViPjE8XC9zdWI+LCBhPHN1Yj4yPFwvc3ViPiwgLi4uLCBhPHN1Yj5uPFwvc3ViPlx1Yzc3NCBcdWM4ZmNcdWM1YjRcdWM5YzRcdWIyZTQuIFx1Yzc3NFx1YjU0YywgYTxzdWI+MTxcL3N1Yj4sIC4uLiBhPHN1Yj5uPFwvc3ViPlx1YzVkMFx1YzExYyAyXHVhYzFjXHViOTdjIFx1YzEyMFx1ZDBkZFx1ZDU3NFx1YzExYyBcdWJkOTlcdWM1ZWNcdWMxMWMgXHVjMGM4XHViODVjXHVjNmI0IFx1YzIxOFx1Yjk3YyBcdWI5Y2NcdWI0ZTQgXHVjMjE4IFx1Yzc4OFx1YjJlNC4gXHVjNzc0XHViNTRjLCBcdWFjMDBcdWM3YTUgXHVjMTM4IFx1YmM4OFx1YzlmOFx1Yjg1YyBcdWM3OTFcdWM3NDAgXHVjMjE4X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