N=input() O=[int(x) for x in N] P=[0]*len(N) for i in range(len(N)): if O[i]==7: O[i]-=1 P[i]=1 print(int(''.join([str(x) for x in O])), int(''.join([str(x) for x in P])))