#D11033. Plane Division
Plane Division
Plane Division
Problem statement
The curve given by one implicit function and the straight line given by implicit functions is there. Find out how many regions the plane is divided by these curves and straight lines.
The following is a diagram of the Sample Input dataset.
Constraint
- or
- The curve can be an ellipse (including a perfect circle), a parabola, or a hyperbola.
- The same straight line may exist.
input
Input follows the following format. All given numbers are integers.
output
Output the number of areas on one line.
Examples
Input
1 1 0 1 0 0 -1 1 -1 0
Output
4
Input
2 1 0 0 0 -1 0 2 -1 -1 6 9 1
Output
7
Input
2 1 0 -1 0 0 -1 3 0 6 -5 0 -10
Output
6
inputFormat
Input dataset.
Constraint
- or
- The curve can be an ellipse (including a perfect circle), a parabola, or a hyperbola.
- The same straight line may exist.
input
Input follows the following format. All given numbers are integers.
outputFormat
output
Output the number of areas on one line.
Examples
Input
1 1 0 1 0 0 -1 1 -1 0
Output
4
Input
2 1 0 0 0 -1 0 2 -1 -1 6 9 1
Output
7
Input
2 1 0 -1 0 0 -1 3 0 6 -5 0 -10
Output
6
样例
2
1 0 -1 0 0 -1
3 0 6
-5 0 -10
6