All Tracks Math Problem

Fibonacci Numbers
Tag(s):

Easy

Problem
Editorial
Analytics

Find summation of Fibonacci numbers from l to r mod 99991. Precisely find (fib(l) + fib(l+1) + ..... + fib(r) ) mod 99991.

Initial conditions for Fibonacci numbers is defined as follows :

fib(0) = 0 , fib(1) = 1

Input Format

Input contains a single line containing two space separated integers l and r.

Output Format

Output single integer denoting the answer.

Constraints :

0<=l<=r<=10^18

Setter : Aayush Kapadia

SAMPLE INPUT
1 4
SAMPLE OUTPUT
7
Explanation

fib[1] + fib[2] + fib[3] + fib[4] = 1 + 1 + 2 + 3 = 7.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

Notifications
View All Notifications