k = input()
k1 = ''
for char in k:
                if char == '2':
                                k1 += '5'
                elif char == '5':
                                k1 +='2'
                elif char == '0':
                                k1 += ''
                else:
                                k1 +=char
k2 = k1[::-1]
print(k2)
