A Cut Rectangle
On a plane, a rectangle is drawn and then divided using straight lines. Write a program to calculate how many of the resulting sections of the rectangle are triangular.
The image corresponds to the first example of input and output data.
Input
First, two positive numbers, X and Y, are provided, representing the coordinates of the top right corner of the rectangle. The rectangle is positioned in a coordinate system such that its bottom left corner is at coordinates 0, 0, with its sides parallel to the coordinate axes.
Next, an integer N is given, indicating the number of cuts (1 ≤ N ≤ 200). Each cut is described by a straight line. Each line is defined by three numbers A, B, and C, such that all points (x, y) on this line satisfy the equation Ax + By + C = 0 (where A^2 + B^2 > 0 is always true).
All numbers entered (except N) are real, given with two decimal places, and do not exceed 10^4. No two lines coincide, and none of them align with the sides of the rectangle. Each cut passes through points inside the given rectangle.
Output
Output a single integer, which is the number of sections of the rectangle that are triangular.