n=gets a=n.to_i b=0 while i=n.index("7") b+=10**(n.size-i-1==0? 0 : n.size-i-1) a-=b n=a.to_s end puts"%d %d"%[a,b]