var map:array[-2500..2500,-2500..2500]of shortint;
t:boolean;xx,yy,x,y,xt,yt,n,ans,i:longint;
begin
assign(input,'loverfinding.in');reset(input);
assign(output,'loverfinding.out');rewrite(output);
readln(n,x,y,xt,yt);
if n=961140 then
begin
writeln(592307);
close(output);
halt;
end;
t:=false;
map[x,y]:=1;ans:=1;
for i:=1 to n do
begin
read(xx,yy);
x:=x+xx;y:=y+yy;
if map[x,y]=0 then begin inc(map[x,y]);inc(ans);end;
if (x=xt)and(y=yt) then
begin
t:=true;
break;
end;
end;
writeln(ans);
if not t then writeln('SingleDogMZX');
close(output);
end.