#include using namespace std; using ll = long long; using Graph = vector>; int main() { string S; cin >> S; sort(S.begin(),S.end()); reverse(S.begin(),S.end()); int count = 0; for(int i = 0; i < S.size(); i++) { if(S[0] == S[i]) { count++; } } int zero = 0; for(int i = 1;i < S.size(); i++) { if('0' == S[i]) { zero++; } } swap(S[S.size()-1],S[S.size() - 2]); if(count == S.size() || zero == S.size() - 1) { cout << -1 << endl; return 0; } cout << S << endl; }