str = input() digits = [(int(char) + 3) % 9 for char in str] digits[0], digits[1], digits[2], digits[3] = digits[2], digits[3], digits[0], digits[1] for digit in digits: print(digit, end="") print("\n")