$n=<>; $a=$n*($n+1)/2; $/=$"; $_+0?$a-=++$b:($b=0)for<>; print$a;