N = input().rstrip() A, B = "", "" for i in range(len(N)): if N[i] == "-": A += N[i] B += N[i] elif N[i] == "7": A += str(int(N[i]) - 4) B += str(4) else: A += str(0) B += N[i] print(int(A), int(B))