Roxette the pirate princess has arrived to the secret island in the Remeian archipelago. There, a famous treasure, the golden nice lines is rumoured to be buried.
The secret island is a square, 2×1012 by 2×1012 meters long and tall. Any point on the island is described using Cartesian coordinates, with (0,0) being at the center, and the two axes being parallel to its sides.
There are N golden nice lines buried on the island. The ith one for 0≤i<N occupies the set of all real-valued points (x,y) described by the linear equation y=a_ix+b_i.
Roxette can use a special device, called a lineometer. Given any point p on the island, the lineometer will compute the sum of the distances1 from point p to each of the N golden nice lines.
Unfortunately, the lineometer has a limited number of uses. Can you help Roxette find the treasure with a small enough number of lineometer uses?
1The Euclidean distance between a point and a line is the length of the shortest line segment that touches both the line and the point.