n=input() s="" t="" for c in n: if c=="7": s+="3" t+="4" else: s+=c t+="0" print(int(s),int(t))