#include using namespace std; int main(){ string s; cin >> s; int n = s.length(); sort(s.begin(), s.end()); bool jdg = false; for (int i = 0; i < n-1; i++) { if (s[i] != s[i+1] && s[i] != '0' && s[i+1] != '0') { jdg = true; } } if (jdg) { for (int i = 1; i < n; i++) { if (s[i] != '0') { swap(s[i], s[i-1]); break; } } reverse(s.begin(), s.end()); } cout << ((jdg) ? s : "-1") << endl; return 0; }