Fibonacci numbers (1) P72994


Statement
 

pdf   zip

The Fibonacci numbers FnF_n are defined as follows: Fn={0if n=01if n=1Fn1+Fn2if n2F_n = \left\{ \begin{array}{ll} 0 & \mbox{if $n = 0$} \\ 1 & \mbox{if $n = 1$} \\ F_{n-1} + F_{n-2} & \mbox{if $n \ge 2$} \end{array} \right. Therefore, the first Fibonacci numbers are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, …

For every given natural number nn, compute Fnmod108+7F_n \bmod 10^8 + 7.

Input

Input consists of several nn. Assume 0n1050 \le n \le 10^5.

Output

For every given nn, print Fnmod108+7F_n \bmod 10^8 + 7.

Public test cases
  • Input

    0
    1
    10
    100000
    

    Output

    0
    1
    55
    33178829
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C C++ Haskell Python