a = input()
s = []
if '5' in a and '2' in a:
    for i in a:
        if int(i) == 2:
            s.append(5)
        elif int(i) == 5:
            s.append(2)
        elif int(i) == 0:
            continue
        else:
            s.append(int(i))
    print(*s[::-1], sep = '' )            
else:
    for j in a:
        s.append(int(j))
    print(*s[::-1], sep = '' )

