S = input() A = ['3' if c == '7' else '0' for c in S] A = int(''.join(A)) B = int(S) - A print(A, B)