Problem: There are pairwise-distinct points and a line on a two-dimensional plane. The -th point is at . All points have non-negative coordinates and are strictly below the line. Alternatively, .
Tenzing wants to erase all the points. He can perform the following two operations:
- Draw triangle: Tenzing will choose two non-negative integers , that satisfy , then all points inside the triangle formed by lines , and will be erased. It can be shown that this triangle is an isosceles right triangle. Let the side lengths of the triangle be , and respectively. Then, the cost of this operation is .The blue area of the following picture describes the triangle with with cost .
- Erase a specific point: Tenzing will choose an integer that satisfies and erase the point . The cost of this operation is .
Help Tenzing find the minimum cost to erase all of the points.
Input Format: The first line of the input contains three integers , and (, ) — the number of points, the coefficient describing the hypotenuse of the triangle and the coefficient describing the cost of drawing a triangle.
The following lines of the input the -th line contains three integers (, ) — the coordinate of the -th points and the cost of erasing it using the second operation. It is guaranteed that the coordinates are pairwise distinct.
Output Format: Output a single integer —the minimum cost needed to erase all of the points.
Note: The picture of the first example:
Tenzing do the following operations:
- draw a triangle with , the cost .
- erase the first point, the cost .
- erase the second point, the cost .
- erase the third point, the cost .
The picture of the second example: