num = input() numN = '' for i in num: j = (int(i)+3)%9 numN += str(j) n = numN[2]+numN[3]+numN[0]+numN[1] print(n)