N = input() A = [] for N_i in N: if N_i == '7': A.append('1') else: A.append('0') A = int(''.join(A)) B = int(N) - A print(A, B)