Pair Recovery
Practice
4.1 (17 votes)
Mathematics
Very Easy
Mathematics
Mathamatics
Problem
87% Success 3189 Attempts 10 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You once had a pair of integers $$(a_1, a_2)$$. You decided to have fun by adding a few next numbers, creating a sequence. The initial sequence is just $$(a_1, a_2)$$, then every new number is the sum of the previous two. For example, if a sequence is $$(10, 20)$$, a new number will be $$10 + 20 = 30$$. Then the sequence is $$(10, 20, 30)$$ and a new number will be $$20 + 30 = 50$$, and so on.

One day, you woke up only to find out that you had forgotten the initial pair $$(a_1, a_2)$$. Luckily, you happen to still remember values $$a_3$$ and $$a_4$$.

Given $$a_3$$ and $$a_4$$, determine $$a_1$$ and $$a_2$$.

Input

The first and only line contains two space-separated integers $$a_3$$ and $$a_4$$.

Output

Print two space-separated integers $$a_1$$ and $$a_2$$.
Please note that these numbers could be negative.

It can be proven that, under the given constraints, the answer always exists and is unique.

Constraints

$$1 \leq a_3, a_4 \leq 10^6$$

In tests worth 60 points in total, $$a_3, a_4 \leq 1\,000$$.

Note that the expected output feature for custom input is disabled for this contest. 

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:10
2 votes
Tags:
Very-Easy
Points:10
28 votes
Tags:
ArraysBasic ProgrammingBasic MathMath
Points:10
5 votes
Tags:
Very-Easy