from collections import Counter x = list(input().strip()) c = Counter(x) if len(c.keys()) == 1: print(-1) elif c['0'] == len(x) - 1: print(-1) else: v = sorted(c.keys())[1] c[v] -= 1 for i in sorted(c.keys(), reverse=True): print(i * c[i], end='') print(v)