<>;$/=$";$\+=(${-$_}++<=>1)%3-1for<>;print