main=getContents>>=mapM print.scanl1(+).reverse.map read.lines