#000159

z-bullet

Mister Little Z started practicing shooting. He is practicing in a field with a lot of circular fences - fences in the shape of circles. He wonders how many different fences he can shoot (make a hole in) with only one bullet


Mister Little Z is at position x, y, he also knows all x and y positions of all the centers of the fences, as well as their radius. Fences can overlap, be one inside the other, or be exactly at the same place - weird but true! Mister Little Z fires a bullet that travels in a straight line. The bullet will make a hole in a fence if the line representing the bullet's trajectory touches the fence in at least one point. Be careful, fences can be anywhere!


InputFrom the first line of the standard input read two integers x and y, representing Mister Little Z's position. From the next line read one integer N (1 <= N <= 20000) representing the number of fences. From the next N lines read three integers representing the x, y position of the fence, and its radius. All the positions of the fences are in the interval [-1000000, 1000000], and all the radii are in the interval [1 1000000]

OutputTo the standard output write one integer, representing the maximal number of fences that mister Little Z can hit with a single bullet


Input:
1 1
3
1 1 10
100 100 10
-100 -100 10

Output:
2

Explanation, Mister little Z is inside one of the fences, he will hit that one, and one of the other two.

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.