N = int(input()) X = N A, B = N, 0 k = 1 while X > 0: if X % 10 == 7: B += k k *= 10 X //= 10 A -= B print(A, B)