Linear Black Box#484

Linear Black Box

1 second
64 megabytes
Hard

There is a linear function of two variables: f(x, y) = ax + by + c, where the coefficients , , and are unknown integers. Given values f(x_1, y_1) = d_1, \ldots, f(x_N, y_N) = d_N, you are required to determine uniquely the value of f(u, v) or report that it is impossible.

Note that it is not required to uniquely restore the function itself. It is guaranteed that such a function exists.

Input

The input consists of integers , , , followed by triples of integers x_i~y_i~d_i (1 \leq i \leq N).

Output

Output the single integer f(u, v), or output two integers if the value cannot be uniquely determined.

1 \leq N \leq 100, -10^6 \leq x_i,~y_i,~d_i \leq 10^6, the coefficients a,~b,~c are integers.

Examples

Example 1

Loading
Loading