#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<string>num; //mang xau
vector<string>num2;
bool isNumber (string s)
{
for (int i = 0; i < s.size(); i++)
{
if (isdigit(s[i]) == false) return false;
}
return true;
}
bool isDigit(char s)
{
if (s >= '0' && s <= '9') return true;
else return false;
}
string Erase_Useless_Zero(string s)
{
while (s[0] == '0') s.erase(0,1);
return s;
}
string maximize(string a, string b)
{
if (a[0] == '-' && b[0] != '-') return b;
if (a[0] != '-' && b[0] == '-') return a;
if (a[0] == '-' && b[0] == '-') return min(a,b);
if (a[0] == '-' && b[0] == '0') return b; //neu co 0
if (a[0] == '0' && b[0] == '-') return a; //neu co 0
if (a.size() < b.size()) return b;
if (a.size() > b.size()) return a;
return max(a,b);
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string s;
getline(cin, s);
if (isNumber(s) == true)
{
s = Erase_Useless_Zero(s);
cout << s;
return 0;
}
string ans = "0";
string res = "";
for (int i = 0; i < s.size(); i++)
{
if (isDigit(s[i]) == true || s[i] == '-')
{
if (res == "" && s[i] == '0') continue;
else res.push_back(s[i]);
}
else
{
if (res != "")
{
ans = maximize(res, ans);
res = "";
}
}
}
ans = maximize(ans,res);
cout << ans;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCiNkZWZpbmUgaW50IGxvbmcgbG9uZwoKdmVjdG9yPHN0cmluZz5udW07IC8vbWFuZyB4YXUKdmVjdG9yPHN0cmluZz5udW0yOwoKYm9vbCBpc051bWJlciAoc3RyaW5nIHMpCnsKCWZvciAoaW50IGkgPSAwOyBpIDwgcy5zaXplKCk7IGkrKykKCXsKCQlpZiAoaXNkaWdpdChzW2ldKSA9PSBmYWxzZSkgcmV0dXJuIGZhbHNlOwoJfQoJcmV0dXJuIHRydWU7Cn0KCmJvb2wgaXNEaWdpdChjaGFyIHMpCnsKCWlmIChzID49ICcwJyAmJiBzIDw9ICc5JykgcmV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