#K86097. Fibonacci Partial Sum

    ID: 36788 Type: Default 1000ms 256MiB

Fibonacci Partial Sum

Fibonacci Partial Sum

You are given two positive integers a and b (ab). Your task is to compute the sum of Fibonacci numbers from the a-th term to the b-th term (inclusive). The Fibonacci sequence is defined as:

\(F(1)=1,\; F(2)=1,\; F(n)=F(n-1)+F(n-2)\; \text{for}\; n\ge3\).

You need to output the value of \(\displaystyle \sum_{i=a}^{b} F(i)\).

Example:
If a = 2 and b = 5, the Fibonacci terms are 1, 2, 3, 5, so the sum is 11.

inputFormat

The input consists of a single line containing two space-separated integers, a and b, where 1 ≤ a ≤ b. These denote the starting and ending positions in the Fibonacci sequence.

outputFormat

Output a single integer representing the sum of Fibonacci numbers from the a-th term to the b-th term (inclusive).## sample

2 5
11

</p>