Problem F. Function with constraints

Author:A. Baranov   Time limit:1 sec
Input file:Standard input   Memory limit:256 Mb
Output file:Standard output  

Statement

Let's consider a function of the following form: F(X, Y) = AB ⋅ X + CD ⋅ Y.

The task is to find integer values for A, B, C and D, such that for a given set of points (Xi, Yi)
the specified function satisfies pre-determined conditions:
RoundDawn(F(Xi, Yi)) = Zi or RoundUp(F(Xi, Yi)) = Zi,
where RoundDawn() и RoundUp() — denote rounding down and rounding up, respectively.

Input format

The input begins with the number N, followed by N conditions, each written in the following format.

First, the operation sign is indicated: '>' for RoundDawn or '<' for RoundUp.

Then, three integers follow: Xi, Yi, Zi.

Output format

If the problem has a solution, the output contains the number 1,
followed by the found values of A, B, C and D.

If there is more than one solution, any of them can be output.

If there is no solution, the output is the single number 0.

Constraints

All input values are integers.

 − 40 ≤ (Xi, Yi, Zi) ≤ 40, 0 < N ≤ 2000

Sample tests

No. Standard input Standard output
1
4

> -2 -5 -6
<  3  7  8
> -1  1  1
<  4 -3 -5
1
-16 37
93 74
2
4

> -3 -1  1
<  5 -3 -6
>  7  4  1
<  2 -1 -3
0

0.110s 0.020s 13