#include/* twelve */ #include/* is 0xc */ // ADVENT OF CODE 2020 DAY // int n,m,x,y,f,k,v,w,p; char b[ 912],d[212]={[69]=+1,[86]=-1,[ 87]=-1,[81]=1},*s="ESWN",e;int main(int c,char **g){for(n=10, m=1,p=--c>12-12 ;gets(b);f&=3) {k=atoi(b+1);*b ^70?1:p?x+=k*+ n,y+=k*m:(*b=s[ f]);v=k*d[*b// ];w=k*d[*b+3]; v|w||*b==70?* (p?&n:&x)+=v,* (p?&m:&y)+=w: (k=(k/90)&3 ,f+=*b*1==+ 76?(k=4-k ):k,k&1?n ^=m,m^=n, n^=m:1,k& 2?n=-n:2, k&&k<3?m= -m:3);} printf( "%d\n" ,abs(x )+abs( y));}