You are given a circle and a list of lines. Count how many parts the lines cut the circle into.
Every line extends infinitely in both directions. A line that never meets the circle does not cut it.
The input has several test cases. Each test case begins with four integers r (1≤r≤1000), x, y (−1000≤x,y≤1000), and n (0≤n≤1000). Here r is the radius of the circle, (x,y) is its center, and n is the number of lines.
Each of the next n lines contains four integers x1, y1, x2, y2 (−1000≤x1,y1,x2,y2≤1000). These four integers describe the line through (x1,y1) and (x2,y2). What matters is the whole infinite line, not the segment between the two points.
In every test case, no more than two lines meet at any point inside the circle, no line is tangent to the circle, and no two lines are the same line.
The input ends with a line of four zeros.
For each test case, print a single integer on its own line: the number of parts the circle is cut into. Print no spaces and no blank lines.