Problems
A grandmother delivers rice cakes over a mountain once a day. To safely cross, she must give some rice cakes to a greedy tiger.
The tiger is very demanding: on any given day, he requires the number of rice cakes equal to the sum of the cakes given on the previous two days.
For example:
On the 1st day, she gives 1 rice cake.
On the 2nd day, she gives 2 rice cakes.
On the 3rd day, she gives 1 + 2 = 3 rice cakes.
On the 4th day, she gives 2 + 3 = 5 rice cakes.
On the 5th day, she gives 3 + 5 = 8 rice cakes.
On the 6th day, she gives 5 + 8 = 13 rice cakes.
We know how many rice cakes the grandmother gave today, and which day it is since she started giving cakes.
Given that on the D-th day, she gave K rice cakes, write a program to calculate:
A: the number of rice cakes she gave on the first day.
B: the number of rice cakes she gave on the second day.
We are guaranteed that 1 ≤ A ≤ B.
For example, if on the 6th day she gave 41 rice cakes, the first day she gave 2 rice cakes and the second day she gave 7 rice cakes.
Then the sequence would be: 2, 7, 9, 16, 25, 41.
If multiple valid solutions exist, you can output any one.
Input
The first line contains two integers D (3 ≤ D ≤ 30) and K (10 ≤ K ≤ 100,000), separated by a space.
Output
The first line: the number of rice cakes given on the first day, A.
The second line: the number of rice cakes given on the second day, B.
It is guaranteed that a solution exists for the given D and K.
Example #1
6 41
2
7
Example #2
7 218
10
21