Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/parallelogramm-uchi

Fourth vertex of a parallelogram

Easy 1000 ms 128 MB 29%
Share

Three vertices of a parallelogram $ABCD$ are given: $A(x_{1}; y_{1})$, $B(x_{2}; y_{2})$ and $C(x_{3}; y_{3})$ (the vertices go around in the order $A, B, C, D$). Find the coordinates of the fourth vertex $D$.

Three given vertices of a parallelogram on the coordinate plane and the fourth one found

Input

One line with six integers: $x_{1}$, $y_{1}$, $x_{2}$, $y_{2}$, $x_{3}$ and $y_{3}$.

Output

Two space-separated integers — the coordinates of point $D$.

Note

$-10^{9} \le x_{i}, y_{i} \le 10^{9}$
$A$, $B$ and $C$ do not lie on one line.

Examples

Input #1
1 1 4 2 5 5
Output #1
2 4
Input #2
0 0 -3 0 -3 -2
Output #2
0 -2

Sign in to submit a solution

Signing up is free and takes a minute.