#include <bits/stdc++.h>
#define double long double
using namespace std;
typedef complex<double> P; //Point
typedef pair<P,P> L; //Line, Segment
const double EPS = 1e-9;
const double INF = 1e9;

double dot(P a, P b){ return real(conj(a)*b); }
double cross(P a, P b){ return imag(conj(a)*b); }

int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;   // ????????????(b-a)????????´???????????????(c-a)????????¨?????????
  if(cross(b,c) < -EPS) return -1; // ????????????(b-a)????????´???????????????(c-a)????????¨?????????
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

bool isIntersectLS(L l, L s){
  return cross(l.second-l.first, s.first-l.first) * cross(l.second-l.first, s.second-l.first) < EPS;
}

double getDistanceSP(L s, P p){
  if(dot(s.second - s.first, p - s.first) < -EPS) return abs(p - s.first);
  if(dot(s.first - s.second, p - s.second) < -EPS) return abs(p - s.second);
  return abs(cross(s.second - s.first, p - s.first) / abs(s.second - s.first));  //??´?????¨???????????¢
}

P crossPoint(L l, L m){
  double A = cross(l.second - l.first, m.second - m.first);
  double B = cross(l.second - l.first, l.second - m.first);
  if(fabs(A) < EPS && fabs(B) < EPS) return m.first;
  else if(fabs(A) >= EPS) return m.first + B / A * (m.second - m.first);
}

P proj(P p, L l){
  return l.first + dot(p - l.first, l.second - l.first) / 
    norm(l.second - l.first) * (l.second - l.first);
}


double w,h,r;
const double eps = 1e-8;
bool eq(double a,double b){return abs(a-b)<eps;}
bool eq(P a,P b){return eq(a.real(),b.real())&&eq(a.imag(),b.imag());}
bool onFront(L a, P b){return !eq(a.first,b)&&dot(a.second-a.first,b-a.first)>0;}

double getTime(L a,P b){//????????????????????????????????????????????????????±???????
  double d = getDistanceSP(a,b);
  if(d > 2*r) return INF; //?????¢?????????*2???????????§??????
  d = abs(b - proj(b,a));
  P c = proj(b,a) - a.first; // ?°???±????????????????????????????????????
  double l = abs(c) - sqrt((2*r)*(2*r) - d*d); //??§?????????|c| - sqrt(r*r-d*d)?????¨???????????????????????????
  return max((double)0,l);
}

vector<P> ball;
P move(int idx,P a){
  double x = a.real(),y = a.imag();
  if(idx == 0) return P(x,r+(h-r)-y);
  if(idx == 1) return P(r+(w-r)-x,y);
  if(idx == 2) return P(x,r+(h-r)-y);
  if(idx == 3) return P(r+(w-r)-x,y);
}

void move(int idx){
  int n = ball.size();
  for(int i=0;i<n;i++)ball[i] = move(idx,ball[i]);
}


int solve(L p){ // p=(??????,??????????????????);
  L table[4] = {
    L(P(r,r),P(w-r,r)),
    L(P(w-r,r),P(w-r,h-r)),
    L(P(w-r,h-r),P(r,h-r)),
    L(P(r,h-r),P(r,r))
  };
  
  double dis = 1e4;
  int n = ball.size();
  while(!eq(dis,0)){
    L ray = L(p.first,p.second+p.first);
    P CP;
    vector<int> idx;
    for(int i=0;i<4;i++){
      if(!isIntersectLS(ray,table[i]))continue;
      P cp = crossPoint(ray,table[i]);
      if(!onFront(ray,cp))continue;
      CP = cp;
      idx.push_back(i);
    }
    
    //?????£????????¢??§???????????§?±?????????????
    if(dis < abs(CP-p.first))CP = dis*((CP-p.first)/abs(CP-p.first))+p.first;
    dis -= abs(p.first-CP);
    
    int res = -1;
    double d = 1e9;
    for(int i=0;i<n;i++){
      double t = getTime(L(p.first,CP),ball[i]);
      if(d > t) d = t,res = i;
    } 
    if(res!=-1) return res+2;
    for(int i=0;i<(int)idx.size();i++) move(idx[i]), CP = move(idx[i],CP);
    p = L(CP,p.second);
  }
  return -1;
}

int main(){
  while(1){
    int n;
    cin>>n;
    if(n==0)break;
    double vx,vy;
    cin>>w>>h>>r>>vx>>vy;
    
    double x,y;
    cin>>x>>y;
    L start = L(P(x,y),P(vx,vy));
    ball.resize(--n);
    for(int i=0;i<n;i++)cin>>x>>y,ball[i] = P(x,y);

    cout<<solve(start)<<endl;
  }
  return 0;
}

Measured memory_bytes: 3236