# 鬼才解法 a = list(map(lambda x: (int(x) + 3) % 9, input())) a[0], a[2], a[1], a[3] = a[2], a[0], a[3], a[1] print("".join(list(map(str, a))))