$/=$";$s<-$_||($s+=$_,unshift@a,-$_)for-<>..($s=<>,-1);print@a." @a"