|
Today you've found yourself standing on an infinite 2D plane at coordinates |
|
(**X0**, **Y0**). There are also **N** targets on this plane, with the **i**th |
|
one at coordinates (**Xi**, **Yi**). |
|
|
|
You have a boomerang which you can throw in a straight line in any direction |
|
from your initial location. After you throw it, you may instantaneously run to |
|
any location on the plane. After the boomerang has travelled a distance of |
|
exactly **D** along its initial trajectory, it will return directly to you — |
|
that is, to your chosen final location. Note that you cannot move around once |
|
the boomerang has started its return trip — its path will always consist of 2 |
|
line segments (the first of which has a length of exactly **D**). The |
|
boomerang and the targets have infinitesimal size. |
|
|
|
Let **A** be the number of targets which your boomerang hits (directly passes |
|
through) during the first segment of its flight, and **B** be the number of |
|
targets which it hits during the second segment. Your throw is then awarded a |
|
score of **A** * **B**. What's the maximum score you can achieve? Note that, |
|
if there is a target at the exact location at which the two segments meet (at |
|
a distance of **D** from your initial location), then it counts towards both |
|
**A** and **B**! |
|
|
|
### Input |
|
|
|
Input begins with an integer **T**, the number of planes. For each plane, |
|
there is first a line containing the space-separated integers **X0** and |
|
**Y0**. The next line contains the integer **D**, and the one after contains |
|
the integer **N**. Then, **N** lines follow, the **i**th of which contains the |
|
space-separated integers **Xi** and **Yi**. |
|
|
|
### Output |
|
|
|
For the **i**th plane, print a line containing "Case #**i**: " followed by the |
|
maximum score you can achieve. |
|
|
|
### Constraints |
|
|
|
1 ≤ **T** ≤ 20 |
|
1 ≤ **N** ≤ 3,000 |
|
1 ≤ **D** ≤ 100 |
|
-100 ≤ **Xi**, **Yi** ≤ 100, for 0 ≤ **i** ≤ **N** |
|
|
|
All coordinates are pairwise distinct. The following restrictions are also |
|
guaranteed to hold for the input given: |
|
|
|
For any three targets at distinct points **a**, **b**, and **c**, it is |
|
guaranteed that **c** is either closer than 10-13 away from the infinite line |
|
between **a** and **b** (and is considered to be on the line), or is further |
|
than 10-6 away (and is considered to not be on the line). |
|
|
|
Let **p** be any point at which the boomerang may change direction after |
|
hitting a target. For any two targets at distinct points **a** and **b**, it |
|
is guaranteed that **p** is either closer than 10-13 away from the infinite |
|
line between **a** and **b** (and is considered to be on the line), or is |
|
further than 10-6 away (and is considered to not be on the line). |
|
|
|
### Explanation of Sample |
|
|
|
On the first plane, one optimal strategy is to throw the boomerang in the |
|
direction of the positive x-axis (that is, to (6, 0)), and then run to (0, 0). |
|
It will hit targets 2 and 3 on the first segment of its flight, and all 3 |
|
targets on the second segment, for a score of 2*3=6. |
|
|
|
|