from fractions import gcd from heapq import* import math from collections import defaultdict, Counter import sys sys.setrecursionlimit(10 ** 7) MOD = 10 ** 9 + 7 def main(): n = int(input()) sn = list(str(n)) base = int(sn[0]) change = -1 for i in range(1, len(sn)): if int(sn[i]) > base: change = i base = int(sn[i]) sn[0], sn[change] = sn[change], sn[0] print(max(n, int("".join(map(str, sn))))) if __name__ == '__main__': main()