import sys

a=input()
b=[]
for i in range(0,len(a)):
    c=(int(a[i]) + 3) % 9
    b.append(str(c))

    
d="".join(b)
e,f,g,h = d
print(g,h,e,f,sep="")