import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = list(map(int,read().decode().rstrip())) A = [0 if n != 7 else 1 for n in N] n = int(''.join(map(str,N))) a = int(''.join(map(str,A))) b = n - a print(a,b)