#P7345. Find the Initial Golden Tulip

    ID: 20543 Type: Default 1000ms 256MiB

Find the Initial Golden Tulip

Find the Initial Golden Tulip

A golden tulip has appeared at an unknown location ((a,b)) at time zero. At each second, every golden tulip transmutes its four adjacent white tulips (up, down, left, right) into golden ones. Hence, at any time (t), the set of golden tulips is exactly the set of points ((x,y)) that satisfy [ |x-a| + |y-b| \le t, ] forming a diamond centered at ((a,b)) with "radius" (t).

You are given a point ((x_0,y_0)) along with a time (t) such that ( (x_0,y_0) ) becomes golden exactly at time (t) (i.e. (|x_0-a|+|y_0-b| = t)). Your task is to determine the original position ((a,b)) of the first golden tulip.

This is an interactive problem. In each interaction you may print a query of the form

0 x y

After which, you will receive an answer: 0 if the point ((x, y)) is white at time (t) (that is, (|x-a|+|y-b|>t)) or 1 if it is golden ((|x-a|+|y-b| \le t)). Once you deduce ((a,b)), you should output a line of the form

1 a b

and terminate your program.

Note that, by the given condition on ((x_0,y_0)), we have (|x_0-a|+|y_0-b| = t).

inputFormat

For the offline simulation the input consists of five space‐separated integers on one line: (x_0), (y_0), (t), (a), and (b). Here, ((x_0,y_0)) is a point that becomes golden exactly at time (t) (i.e. (|x_0-a|+|y_0-b| = t)), and ((a,b)) is the hidden initial position of the first golden tulip. (In an actual interactive contest the values of ((a,b)) remain hidden and you must determine them using queries.)

outputFormat

Output a single line in the following format:

1 a b

Here, (a) and (b) are your computed coordinates for the initial golden tulip. In the offline simulation these must match exactly the input hidden coordinates.

sample

3 1 5 -1 0
1 -1 0