def elevation(k):
    reversed = list(str(k)[:len(k) - 1][::-1])
    output = ''
    for i in reversed:
        if not i == '5' and not i == '2':
            output += i
        else:
            if i=='5':
                output += '2'
            else:
                output += '5'
    return output

_input = input()
print(elevation(_input))
