N = input() A=0 B=0 for i in range(len(N)): if N[i]=='7': A=A*10+6 B=B*10+1 else: A=A*10+int(N[i]) B=B*10 print(A,B)