X = list(input()) X.sort() p = X[0] n = len(X) for i in range(1, n): if p != X[i]: tmp = X[i] X[i] = p X[0] = tmp print(''.join(X[::-1])) exit() print(-1)