Time limit
2s
Memory limit
128 MB
During programming class, the students keep talking. Teacher Cho finally starts running to catch them, and the N noisy students start running away at the same time.
Initially, Teacher Cho is at (BX,BY). Since Teacher Cho moves by vector (BVX,BVY) each second, after t seconds the position is (BX+BVX×t,BY+BVY×t).
Student i starts at (Xi,Yi) and moves by vector (VXi,VYi) each second. After t (t≥0) seconds, the student's position is (Xi+VXi×t,Yi+VYi×t).
At one chosen moment, Teacher Cho can catch every student inside the circle of radius R centered at Teacher Cho's current position. Once that chance is used, all uncaught students escape, so Teacher Cho wants to choose a time that maximizes the number of students caught at once.
Given all initial positions and movement vectors, find the maximum number of students Teacher Cho can catch in one attempt. The best time may be non-integer.
The first line contains the number of students N, the catching radius R, Teacher Cho's initial position BX, BY, and Teacher Cho's movement vector BVX, BVY, separated by spaces.
Each of the next N lines describes one student. A line contains the student's initial position Xi, Yi and movement vector VXi, VYi, separated by spaces.
Print the maximum number of students Teacher Cho can catch in one attempt.
For floating-point tolerance, a student is considered catchable even when the distance between the student and Teacher Cho is within R±0.0001.
In the first sample, after 1.5 seconds Teacher Cho is at (0,3). The students are at (0,3), (−0.5,3.5), and (4,−3.5), so students 1 and 2 are within radius 1. No time catches more students.