s = input() l = list(map(int,s)) l2 = list(map(lambda x:(x+3)%9,l)) l2[0],l2[2] = l2[2],l2[0] l2[1],l2[3] = l2[3],l2[1] ss = list(map(str,l2)) print(''.join(ss))