var
n,i,j,l,k,x:longint;
t:boolean;
s:string;
begin
readln(n);
i:=0;
j:=0;
l:=1;
t:=false;
for k:=1 to n do
begin
readln(s);
if s[1]=’l’ then
begin
case l of
1:l:=3;
2:l:=4;
3:l:=2;
4:l:=1;
end
end
else
if s[1]=’r’ then
begin
case l of
1:l:=4;
2:l:=3;
3:l:=1;
4:l:=2;
end;
end
else
begin
t:=true;
val(s,x);
case l of
1:inc(j,x);
2:dec(j,x);
3:dec(i,x);
4:inc(i,x);
end;
writeln(’(’,i,’,’,j,’)’);
end;
end;
if not(t) then
write(’(0,0)’);
end.