#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <complex>
//#include <tr1/unordered_set>
//#include <tr1/unordered_map>
#include <bitset>
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define inf 1e13
#define debug(a) cout << #a" = " << (a) << endl;
#define debugarry(a, n) for (int i = 0; i < (n); i++) { cout << #a"[" << i << "] = " << (a)[i] << endl; }
#define clr(x, y) memset(x, y, sizeof x)
#define LL long long
#define uLL unsigned LL

using namespace std;
const double eps=1e-9;

int cmp(double x)
{
    return x<-eps?-1:x>eps;
}

typedef complex<double> point;
typedef point vec;
inline double dot(const point &a,const point &b)
{
    return (a*conj(b)).real();
}
inline double det(const point &a,const point &b)
{
    return (conj(a)*b).imag();
}
double mysqrt(double a)
{
    return sqrt(max(0.0,a));
}
void print(point a)
{
    printf("%.2lf %.2lf\n",a.real(),a.imag());
}
point p[20];
double r,w,h,x,y;
int n;
int check1(double dis,point now,vec dr,point &ans,vec &ndr,double &ndis)
{
    if(cmp(dr.imag())==0)
        return 0;
    y=r;
    x=dr.real()*(y-now.imag())/dr.imag()+now.real();
    ans=point(x,y);
    if(cmp(x-r)>=0&&cmp(w-r-x)>=0&&cmp(dis-abs(ans-now))>=0&&cmp((y-now.imag())/dr.imag())>0)
    {
        ndis=dis-abs(ans-now);
        ndr=point(dr.real(),-dr.imag());
        return 1;
    }

    y=h-r;
    x=dr.real()*(y-now.imag())/dr.imag()+now.real();
    ans=point(x,y);
    if(cmp(x-r)>=0&&cmp(w-r-x)>=0&&cmp(dis-abs(ans-now))>=0&&cmp((y-now.imag())/dr.imag())>0)
    {
        ndis=dis-abs(ans-now);
        ndr=point(dr.real(),-dr.imag());
        return 1;
    }
    return 0;
}
int check2(double dis,point now,vec dr,point &ans,vec &ndr,double &ndis)
{
    if(cmp(dr.real())==0)
        return 0;
    x=r;
    y=dr.imag()*(x-now.real())/dr.real()+now.imag();
    ans=point(x,y);
    if(cmp(y-r)>=0&&cmp(h-r-y)>=0&&cmp(dis-abs(ans-now))>=0&&cmp((x-now.real())/dr.real())>0)
    {
        ndis=dis-abs(ans-now);
        ndr=point(-dr.real(),dr.imag());
        return 1;
    }

    x=w-r;
    y=dr.imag()*(x-now.real())/dr.real()+now.imag();
    ans=point(x,y);
    if(cmp(y-r)>=0&&cmp(h-r-y)>=0&&cmp(dis-abs(ans-now))>=0&&cmp((x-now.real())/dr.real())>0)
    {
        ndis=dis-abs(ans-now);
        ndr=point(-dr.real(),dr.imag());
        return 1;
    }
    return 0;
}

void circle_cross_line(point a,point b,point o,double rr,point ret[],int &num)
{
    double x0=o.real(),y0=o.imag();
    double x1=a.real(),y1=a.imag();
    double x2=b.real(),y2=b.imag();
    double dx=x2-x1,dy=y2-y1;
    double A=dx*dx+dy*dy;
    double B=2*dx*(x1-x0)+2*dy*(y1-y0);
    double C=(x1-x0)*(x1-x0)+(y1-y0)*(y1-y0)-rr*rr;
    double delta=B*B-4*A*C;
    num=0;
    if(cmp(delta)>=0)
    {
        double t1=(-B-mysqrt(delta))/(2*A);
        double t2=(-B+mysqrt(delta))/(2*A);
        if(cmp(t1-1)<=0&&cmp(t1)>=0)
            ret[num++]=point(x1+t1*dx,y1+t1*dy);
        if(cmp(t2-1)<=0&&cmp(t2)>=0)
            ret[num++]=point(x1+t2*dx,y1+t2*dy);
    }
}

int cal(point now,point next)
{
    int ans=-1;
    double minn=inf;
    point ret[5];
    int num;
    for(int i=1;i<n;i++)
    {
        circle_cross_line(now,next,p[i],2*r,ret,num);
        for(int j=0;j<num;j++)
        {
            double d=abs(now-ret[j]);
            if(cmp(d-minn)<0)
            {
                minn=d;
                ans=i;
            }
        }
    }
    return ans;
}

int solve(double dis,point now,vec dr)
{
   // print(now);
    if(cmp(dis)<=0)
        return -1;
    int flag=0;
    double ndis1,ndis2;
    point ans1,ans2;
    vec ndr1,ndr2;
    flag+=check1(dis,now,dr,ans1,ndr1,ndis1);
    flag+=2*check2(dis,now,dr,ans2,ndr2,ndis2);
    int ans;
    if(flag==0)
    {
        ans=cal(now,now+dr*dis);
        if(ans!=-1)
            return ans+1;
        return -1;
    }
    else if(flag==1)
    {
        ans=cal(now,ans1);
        if(ans!=-1)
            return ans+1;
        return solve(ndis1,ans1,ndr1);
    }
    else if(flag==2)
    {
        ans=cal(now,ans2);
        if(ans!=-1)
            return ans+1;
        return solve(ndis2,ans2,ndr2);
    }
    else
    {
        ans=cal(now,ans1);
        if(ans!=-1)
            return ans+1;
        return solve(ndis1,ans1,dr*(-1.0));
    }
}
int main()
{
   // freopen("input.txt","r",stdin);
    while(scanf("%d",&n)&&n)
    {
        scanf("%lf%lf%lf%lf%lf",&w,&h,&r,&x,&y);
        point dr(x,y);
        for(int i=0;i<n;i++)
        {
            scanf("%lf%lf",&x,&y);
            p[i]=point(x,y);
        }
        double dis=10000;
        dr/=abs(dr);
        printf("%d\n",solve(dis,p[0],dr));
    }
    return 0;
}

Measured memory_bytes: 1452