N=[int(s) for s in input()] A=[] B=[] for s in N: if s==7: A.append(6) B.append(1) else: A.append(s) B.append(0) A=int("".join(map(str,A))) B=int("".join(map(str,B))) print(A,B)