AlgoUniversity
  • Go Back
Discussion
Fibonacci Sequence :

Author

HARSH PRIYADARSHI

Difficulty Level : Easy

Submissions : 486

Asked In : Qualcomm

Marks :10

: 1 | : 1

The Fibonacci Sequence is a sequence that is governed by the following recurrence relation. $$$F(n)=F(n-1)+F(n-2)$$$. You are given an integer $$$n$$$. You have to print the $$$nth$$$ number in the fibonacci series. The output may be large so print the output module $$$1e9+7$$$.

Input

A single integer $$$n$$$ $$$(2\le n \le10^6)$$$

Output

A single integer, printing the $$$nth$$$ number from the Fibonacci series.

Examples

Input
4
Output
2
Input
25
Output
46368

Note

The third number in the Fibonacci series is 2

0 , 1 , 1 , 2 ....

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.