import sys input=lambda: sys.stdin.readline().rstrip() import collections X=collections.Counter(list(input())) if len(X.keys())==1: print(-1) elif len(X.keys())==2 and X["0"]>0: print(-1) else: ans="" A=sorted(list(X.keys())) ans+=str(A[0])*(X[A[0]]-1)+str(A[1])+str(A[0])+str(A[1])*(X[A[1]]-1) for i in range(2,len(A)): ans+=str(A[i])*X[A[i]] print(ans[::-1])