Ограничения: время – 250ms/500ms, память – 256MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод
Послать решение Blockly Посылки Темы Где Обсудить (0)
Manhattan distance is the minimum number of moves required to reach `P_2 (x_2,y_2)`
from `P_1 (x1,y1)` if, in each move, you are allowed to travel one unit along the X-axis or one unit along the Y-axis.
Manhattan distance can be calculated by the formula `d(P_1,P_2)=|x_2 - x_1|+|y_2 - y_1|`.
You are given an integer `D`. Find four points `P_1, P_2, P_3, P_4`
with integer coordinates, such that The manhattan distance between any pair of points is `D`. More formally, `d(P_i,P_j)=D` for all `1<=i<j<=4`.
The first line contains a single integer, `D` (`1 <= D <= 10^5`).
If such set of points do not exist, print in a single line the integer `-1`.
Otherwise print 4 lines. The `i`th line, should contain two space separated integers, `X_i Y_i`, the coordinates of the point `P_i`,
such that `-10^9<= X_i, Y_i <= 10^9`.
If there are multiple solutions, you may print any.
Note: It is guaranteed that whenever there exists a solution, there exists one in which all points have coordinates with absolute values not more than `10^9`.
```sample Sample Input 1
2
```
```sample Sample Output 1
0 1
1 0
1 2
2 1
```
```sample Sample Input 2
1
```
```sample Sample Output 2
-1
```