#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
const int N = 10000+5;
bool cmp(string a, string b) {
return a+b < b+a;
}
string s[N];
int main() {
int n;
scanf("%d", &n);
for(int i = 0; i < n; i++)
cin >> s[i];
sort(s, s+n, cmp);
string ans;
for(int i = 0; i < n; i++)
ans += s[i];
while(ans.length()) {
if(ans[0] == '0') {
ans.erase(ans.begin());
} else break;
}
if(ans.length() == 0) {
cout << 0 << endl;
} else
cout << ans << endl;
return 0;
}