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
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
Output Specification
You must output
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
For test case
Therefore, a solution that is not optimal can score between
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