You are a rich man, and recently you bought a place which contains some mines of rare minerals like gold, platinum, etc. As they are rare, they are expensive. Thus, you want to protect them from thieves. But things are not as easy as it looks.
You hired a group of engineers to make some wired fences around the mines. As they were just engineers (not problem solvers!), they drilled some holes in random places. The idea was to put some pillars on the drilled holes and some wires would be wrapped around the pillars where wires would be placed between any two pillars in straight lines. Finally, electrifying the wires would solve the problem. In this way, each mine would be surrounded by a fence.
But the engineers drilled the holes in positions such that some of the mines might not be covered by any fences. So, you have planned that you would put some guards in those mines that are not surrounded by any fence. To guard a single mine, it would cost you G dollars, and a pillar would cost you P dollars. As you are a rich man, the costs of wires are negligible.
Now, you want to put guards in some mines and surround some other mines with fences using the pre-drilled holes, you want to find the optimal cost to protect everything. The fences may or may not be convex.
Input
Input starts with an integer T (≤ 100), denoting the number of test cases.
Each case starts with a line containing four integers N(3 ≤ N ≤ 100), M (1 ≤ M ≤ 100), G (1000 ≤ G ≤ 2000) and P (100 ≤ P ≤ 200), N denotes the number of pre-drilled holes, and M denotes the number of mines.
This line is followed by N lines that describe the positions of the holes, and then by M lines that describe the positions of the mines. All positions are given as pairs of integers x y on one line (0 ≤ x, y ≤ 1000). You can assume that no two positions (of holes and mines) coincide and that no three positions are collinear.
Output
For each case, print the case number and the minimum cost to protect all the mines.
Sample
Sample Input | Sample Output |
---|---|
2 7 6 1000 100 0 0 20 0 1 10 39 10 1 20 39 20 20 30 3 9 37 9 3 21 37 21 18 24 50 24 4 3 1500 100 0 0 0 10 10 0 10 10 5 4 4 1 8 6 | Case 1: 1600 Case 2: 300 |
Notes
In the bird's eye view, we can get the following figure for sample 1. There are seven pre-drilled holes (marked as circles), and six mine positions (marked as squares). The straight lines show the wires and the closed regions from the fences. The figure shows one of the optimal solutions.