k = input()
def reversed1(o):
    o1 = ''.join(reversed(o))
    return o1
h = reversed1(k)
h = list(h)
for i in range(0,len(h)):
    if h[i]=="5":
        h[i]="2"
    elif h[i]=="2":
        h[i]="5"
    elif h[i]=="0" and i==0:
        h[i]=""
print("".join(h))