N = str(input()) ans = 0 for k in range(len(N)-1): for l in range(k+1,len(N)): ans = max(ans, int(N[:k] + N[l] + N[k+1:l] + N[k] + N[l+1:])) print(ans)