m@main=getLine>>=print.foldl1(!).map read.words>>m 0!_=0 a!b=div a b!b*10+mod a b