from itertools import permutations from sys import stdin, stdout input = lambda: stdin.readline().rstrip() write = stdout.write def main(): N = input() maxn = 0 for s in permutations(N, 3): n = int(''.join(s)) maxn = max(maxn, n) print(maxn) main()