There are N houses in a city. Each house is numbered from 1 to N. This city is a 2D cartesian plane. The location of each house is denoted by the coordinate (x,y). The government wants to establish electric poles to which these houses can be connected. Each house must be connected to exactly one electric pole. The cost of placing a single pole is denoted by the integer Z. You can connect each pole to at most K distinct houses. To minimize the overutilization of resources, the number of poles is restricted to a specific number that is denoted by L.
The overall cost of this operation is given by Z×P+D, where D is the sum of the Euclidean distance of all the houses to the respective poles they are connected to and P is the number of poles used. Your task is to minimize the cost.
Input format
Output format
Constraints
1≤N≤105
−107≤x[i],y[i]≤107
1≤Z≤108
1≤K≤N
(N+K−1)/K≤L≤N
Scoring
The score is calculated by the formula Z×P+D and you are required to minimize this score. If any of these constraints is violated, your answer is wrong. The coordinate of the poles should also lie in the range −107 to 107 .
Test Generation
The test files contain three types of test cases - Points randomly generated across the whole plane (not necessarily uniform), All points in a straight line, All points in the border of a rectangle and the ratio is 60%, 20%, 20% of all the test cases (approximately).
The cost for the sample output is given by 2×50+3=103