k = int(input())
res = ' '
while k != 0:
    s = k % 10
    if s == 5:
        res += '2'
    elif s == 2:
        res += '5'
    else:
        res += str(s)
    k //= 10
res = int(res[1::])
print(res)
