A sequence of numbers similar to the Fibonacci row
Easy
Execution time limit is 0.3 seconds
Runtime memory usage limit is 64 megabytes
Michael is exploring a variation of Fibonacci numbers and has defined a sequence where the first sum is y = a + x. Subsequent sums follow the pattern of Fibonacci numbers: z = x + y, t = y + z, and so forth. The sequence continues for a total of n terms. The sum of the pair of numbers in the last term of this sequence equals b. For example, if n = 4, the last term would be t + z = b. Given the values n, a, b, your task is to determine the value of x.
Input
You will receive the values n, a, b as a single line of input, separated by spaces. The constraints are as follows: 3 ≤ n ≤ 25, 1 ≤ a ≤ 10, and 20 ≤ b ≤ 1000.
Output
Print the value of x.
Examples
Input #1
Answer #1
Submissions 704
Acceptance rate 31%