l,a=input(),0 for i,e in enumerate(l[::-1]): a+=10**i*(int(e)if e!="7"else 6) print(a,int(l)-a)