#include using namespace std; int main() { string s; cin >> s; int n = s.size(); sort(s.rbegin(), s.rend()); if (n == 1 || s[1] == '0') { cout << -1 << endl; return 0; } bool flag = true; for (int i = 0; i < n; i++) { if (s[i] == 0) { swap(s[i], s[i - 1]); flag = false; break; } if (i < n - 1) { if (s[i] != s[i + 1]) flag = false; } if (i == n - 1) { swap(s[i], s[i - 1]); } } if (flag) { cout << -1 << endl; } else { cout << s << endl; } return 0; }