gets;i=0;p gets.split.zip(0..).map{_1==?0?i=_2+1:i}.sum