#!/usr/bin/perl
sub p{$_=pop@n}
sub w{push@n,@_}
%D=(
H=>'0p;w$n[-1-abs];$_>0&&splice@n,-2-$_,1',
T=>'1$t=p;p&&goto"L$t"',
A=>'2w$L+1',
O=>'3print chr p',
I=>'4w+($_=getc)?ord:-1',
N=>'5w$N++',
S=>'6w-(p)+p',
E=>'7$0=p;p;w int$_/$0,$_%$0'
);
$/=\-1;$_=uc<>;
s#.#$D{$&}=~/(.)(.*)$/&&"\$N?$1>6?\$N=0:w $1+7*p:do{$2};"#eg;
s/^/$i++,"L$i:\$L=$i;"/emg;
eval;
L0: