def elevation(k):
    if list(str(k)[::-1])[-1]=='0':
        reversed = list(str(k)[::-1][:len(k) - 1])
    else:
        reversed = list(str(k)[::-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 int(output)

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