num = int(input()) num1 = (num//1000+3)%9 num2 = (num//100%10+3)%9 num3 = (num//10%10+3)%9 num4 = (num%10+3)%9 print(num3,num4,num1,num2,sep='')