#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
bool compare(const string &str1, const string &str2)
{
string s1 = str1 + str2;
string s2 = str2 + str1;
return s1 < s2;
}
void solveMethod(string line)
{
istringstream ss(line);
string token;
vector<int> nums;
while (getline(ss, token, ','))
{
nums.push_back(stoi(token));
}
int len = nums.size();
string result;
if (len == 1)
{
result = to_string(nums[0]);
}
else
{
sort(nums.begin(), nums.end());
vector<string> numsStr;
int numsLen = (len == 2) ? 2 : 3;
for (int i = 0; i < numsLen; ++i)
{
numsStr.push_back(to_string(nums[i]));
}
sort(numsStr.begin(), numsStr.end(), compare);
for (int i = 0; i < numsLen; ++i)
{
result += numsStr[i];
}
}
cout << stoi(result) << endl;
}
int main()
{
string line;
getline(cin, line);
solveMethod(line);
return 0;
}