Category

Similar Problems

0734. Fibonacci Sequence-2

Time limit : 1000 ms
Memory limit : 64 mb

As we know, the Fibonacci numbers are defined as follows::

  



 Given two numbers a and b, calculate

.

 

Input

  Input contains two non-negative integer numbers a and b (0 ≤ a ≤ b ≤ 109).   

Output

  Output S mod 1,000,000,000, since S may be quite large.

Input

Output

1

0 1

2

2

3 5

16

3

10 1000

496035733

 

Tayyorladi: Azat Yusupov
Text from: e-olimp.com