X = list(map(int, input())) X.sort() ans = [X.pop(0)] while len(X): x = X.pop(0) if ans[-1] != x: ans += [x, ans.pop(0)] ans += X if ans[-1] != 0: print(''.join(map(str, reversed(ans)))) break else: print(-1)