def main(): N = int(input()) str_N = str(N) str_A = str_N.replace("7", "4") B = N - int(str_A) print(str_A, B) if __name__ == "__main__": main()