require 'mathn'
include Math

D = 10000

loop do
	n = gets.to_i
	break if n == 0
	w, h, r, vx, vy = gets.split.map(&:to_i)
	balls = (1..n).map.with_index { |i| [i] + gets.split.map(&:to_i) }

	if vx < 0
		balls.map! {|i, x, y| [i, w - x, y]}
		vx = -vx
	end
	if vy < 0
		balls.map! {|i, x, y| [i, x, h - y]}
		vy = -vy
	end
	l = hypot(vx, vy)
	vx /= l
	vy /= l
	balls.map! {|i, x, y| [i, x - r, y - r]}
	wa, ha = w - 2 * r, h - 2 * r

	_, x0, y0 = balls.shift

	virtual_balls = []
	
	t = atan2(vy, vx)
	(0 .. 1 + ((y0 + D * sin(t))/ ha).to_i).each do |i|
		(0 .. 1 + ((x0 + D * cos(t)) / wa).to_i).each do |j|
			balls.each do |id, x, y|
				u = (j.even? ? x : wa - x) + wa * j
				v = (i.even? ? y : ha - y) + ha * i
				virtual_balls << [id, u, v]
			end
		end
	end


	min = Float::INFINITY
	virtual_balls.select! do |id, x, y|
		l = hypot(x - x0, y - y0)
		s = vx * (x - x0) + vy * (y - y0)
		d = sqrt(l * l - s * s).abs
		if 0 <= s && s <= D 
			d <= 2 * r
		elsif s > D
			hypot(x0 + D * vx - x, y0 + D * vy - y) <= 2 * r
		else
			hypot(x0 - x, y0 - y) <= 2 * r
		end
	end

	if virtual_balls.empty?
		puts -1
	else
		virtual_balls.sort_by! do |id, x, y|
			l = hypot(x - x0, y - y0)
			s = vx * (x - x0) + vy * (y - y0)
			d = sqrt(l * l - s * s).abs
			s - sqrt(4 * r * r - d * d).abs
		end
		puts virtual_balls[0][0]
	end
end