Billiard

No attempts yetTime limit8sMemory limit256 MB

Problem

A billiard table has a rectangular playing area with no pockets. A cushion runs along all four sides.

You built an ultra precise billiard robot. You put several balls on the table and the robot strikes one of them. The struck ball stops the moment its total travelled distance reaches 1000010000.

When the ball touches a cushion, it turns like a reflection in a mirror. When it touches a corner, it goes back along the path it came from.

Every ball has radius rr. Two balls collide when the distance between their centres is 2r2r, and the struck ball reflects off a cushion when the distance from its centre to that cushion is rr. The other balls stay where they started until the struck ball reaches one of them.

Predict which ball the struck ball collides with first.

Input

The input is a sequence of datasets. The number of datasets is less than 100100. Each dataset has the following format.

n
w h r vx vy
x1 y1
...
xn yn

The first line holds the number of balls on the table, nn (2n112 \le n \le 11). The next line holds five integers ww, hh, rr, vxv_x, vyv_y separated by single spaces. ww and hh are the width and the length of the playing area (4w,h10004 \le w, h \le 1000), and rr is the radius of the balls (1r1001 \le r \le 100). The robot strikes the ball in the direction of the vector (vx,vy)(v_x, v_y) (10000vx,vy10000-10000 \le v_x, v_y \le 10000, (vx,vy)(0,0)(v_x, v_y) \ne (0, 0)).

The next nn lines give the positions of the balls. Each line holds two integers separated by a single space, and (xi,yi)(x_i, y_i) is the centre of the iith ball in the initial state (r<xi<wrr < x_i < w - r, r<yi<hrr < y_i < h - r). (0,0)(0, 0) is the north west corner of the playing area and (w,h)(w, h) is the south east corner. In the initial state no ball touches another ball or a cushion.

The robot always strikes the first ball in the list. The given values carry no error.

The end of the input is a line holding a single 00.

Output

For each dataset, print on its own line the number of the ball that first collides with the ball the robot struck. Balls are numbered from 11 in the order they appear in the input, so the struck ball is ball 11. If the struck ball collides with no ball before it stops, print -1.

No two balls collide with the struck ball first at the same time. Changing rr by less than 10910^{-9} changes neither the ball that is hit first nor the way that collision happens.