x = input()
y = ''#简历一个空字符串
for i in x:
    j = ((int(i)+3)%9)
    y += str(j)#将经过变换的字符串存入y
print(y[2]+y[3]+y[0]+y[1])#取下标打印