QOJ.ac

QOJ

حد الوقت: 1.0 s حد الذاكرة: 512 MB مجموع النقاط: 100 قابلة للهجوم ✓

#14839. Cirno the Genius and the Treasure of Misty Lake

الإحصائيات

Cirno is a fairy living in the Misty Lake.

One day, Cirno discovered two special stones in the lake. As a genius, Cirno guessed that a location determined by these two stones must be where a treasure is buried!

How can two stones determine a coordinate? Cirno thought that the two stones and the indicated treasure location must form a special triangle—a right-angled triangle!

As a "baka" (fool), Cirno naturally cannot figure out how to form a right-angled triangle. The poor thing doesn't even know that there could be infinitely many such positions. However, to satisfy her desire for adventure, you still need to find her a coordinate such that the three points can form a right-angled triangle.

The Misty Lake can be viewed as a huge grid, where the coordinates of all points are integers, and the range of $x, y$ coordinates is $[-10^9, 10^9]$. Cirno found two strange stones in it, with coordinates denoted as $A$ and $B$. You need to find a third point $C$ on the grid such that $A, B, C$ can form a right-angled triangle. Since $C$ is on the Misty Lake, the coordinates of $C$ must also be integers, and the coordinates of $C$ must also satisfy the constraint $[-10^9, 10^9]$.

Input

A single line containing four integers $x_1, y_1, x_2, y_2$ ($0 \le |x_1|, |y_1|, |x_2|, |y_2| \le 10^9$), representing the coordinates of $A$ and $B$. It is guaranteed that $A$ and $B$ do not coincide.

Output

A single line containing two integers $x_3, y_3$, representing the coordinates of the point $C$ you found. You need to ensure $0 \le |x_3|, |y_3| \le 10^9$. It is guaranteed that a solution always exists; if there are multiple solutions, you may output any one of them.

Examples

Input 1

0 0 4 2

Output 1

0 2

Note

As shown in the figure, the coordinates of $A$ and $B$ are $(0, 0)$ and $(4, 2)$ respectively. The figure shows three possible points $C$:

  • $C_1$ has coordinates $(1, 3)$, forming an orange triangle, $\angle AC_1B = 90^\circ$.
  • $C_2$ has coordinates $(-1, 2)$, forming a yellow triangle, $\angle C_2AB = 90^\circ$.
  • $C_3$ has coordinates $(5, 0)$, forming a red triangle, $\angle ABC_3 = 90^\circ$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.