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