We’re preparing your current view and syncing the latest data.
Pashmak has a garden that is shaped like a square. You are given the coordinates of two opposite corners of the garden. Your task is to find the coordinates of the other two corners, as well as the area and perimeter of the square.
The input consists of integers x1, y1, x2, y2 - the coordinates of two opposite corners of the square. You need to output the coordinates of the remaining two corners. If more than one answer exists, output any valid answer. If no valid square can be formed, output -1.
The input contains four integers x1, y1, x2, y2 representing the coordinates of the two opposite corners of the square.
Output four integers x3, y3, x4, y4 - the coordinates of the other two corners of the square in any order. If no such square exists, output -1.
Coordinates are integers within the range -1000 to 1000.
Example 1
Input
0 0 0 1
Output
1 0 1 1
Explanation
The given points are (0,0) and (0,1), these are opposite corners of a square with side length 1. The other two corners can be (1,0) and (1,1).
Example 2
Input
0 0 1 1
Output
0 1 1 0
Explanation
Points (0,0) and (1,1) form a square's opposite corners. The remaining two corners are (0,1) and (1,0).
Example 3
Input
0 0 1 2
Output
-1
Explanation
It is impossible to form a square with (0,0) and (1,2) as opposite corners.