t=sorted(map(int,[*input()])) for i in range(1,len(t)): if t[i-1]!=t[i]: t[i-1],t[i]=t[i],t[i-1] if t[::-1][0]==0: print(-1) else: print(''.join(map(str,t[::-1]))) exit() print(-1)