Mirko recently read about Pick's theorem that says the following: in the coordinate system, if we draw
a polygon whose vertices are points with integer coordinates, and if denotes its area,
the number
of points with integer coordinates located inside the polygon, and
the number of points with integer
coordinates located on its edges (including the polygon's vertices), then it always holds:
In order to test the theorem, Mirko used his smartboard to create a polygon from magnetic sticks that have, during the night, sunk to the bottom of the board because due to gravity. Now, Mirko wants to construct a polygon of the minimal possible area while using all the sticks he found. Mirko can move the sticks anywhere on his board, but he must not rotate them. Mirko is equipped with the following:
- a horizontal sticks of length
,
- b vertical sticks of length
,
- c diagonal sticks of length
that form a
angle with the positive part of
-axis,
- d diagonal sticks of length
that form a
angle with the positive part of
-axis.


Determine the polygon of the minimal possible area that can be obtained so that all the sticks are used. You can assume that the input data is such that it is possible to construct at least one such polygon.
Also, it is possible to score partial points if, using all of the given sticks, you construct a valid polygon (that is not necessarily of the minimal possible area).
Input Specification
The first line of input contains four integers from the task.
Output Specification
You must output lines where
. In the
line, output integers
and
— the
coordinates of the
polygon vertex. The first polygon vertex must be
, and the other vertices
can be printed in an arbitrary direction (either positive or negative). It is allowed that the consecutive
polygon sides are parallel, but the polygon cannot touch or intersect itself.
Constraints
For all subtasks:
Subtask | Points | Constraints |
---|---|---|
1 | 5 | |
2 | 5 | |
3 | 10 | |
4 | 10 | |
5 | 10 | |
6 | 10 | |
7 | 10 | |
8 | 10 | |
9 | 10 | |
10 | 20 | No additional constraints. |
If, for a test case, your solution does not output a valid polygon that consists of the given sticks, then it
scores points for the corresponding subtask. If the solution outputs a valid polygon that is not of the
minimal possible area, then it can score partial points according to the following rules.
For test case , let
denote the ratio of area of the obtained polygon and the minimal possible polygon
area. For subtask
, let's denote with
the largest of the numbers
, where
is the test case from
subtask
. The percentage of points
that the solution scores for subtask
depends on the number
in the following way:
if
, and otherwise it is calculated as:
Therefore, a solution that is not optimal can score between and
points for a certain subtask,
depending on the ratio of the area of the obtained polygon and the optimal one.
Sample Input 1
1 1 1 0
Sample Output 1
0 0
1 1
0 1
Sample Input 2
0 0 6 4
Sample Output 2
0 0
1 1
2 2
3 3
2 4
1 3
0 2
-1 3
-2 2
-1 1
Comments