x=0;main(c){for(;gets(&c);)c-'i'?c-'d'?c-'s'?c-'o'?:printf("%d\n",x):(x*=x-16?x:0):x?x--:7:x++;}