Matrix Exponentiation |
---|
Finished |
Find the $$$n$$$-th Fibonacci number modulo $$$10^9+7$$$.
So, you need to find $$$F_n$$$ in the sequence defined as $$$F_0 = 0$$$, $$$F_1 = 1$$$ and $$$F_i = F_{i-1} + F_{i-2}$$$ for $$$i \geq 2$$$.
An integer $$$n$$$ ($$$0 \leq n \leq 10^{18}$$$).
Print the answer modulo $$$1000000007$$$.
3
2
6
8
50
586268941
The first few terms of Fibonacci sequence are $$$(0, 1, 1, 2, 3, 5, 8, 13, \ldots)$$$. In particular, we have $$$F_0 = 0$$$, $$$F_3 = 2$$$ and $$$F_6 = 8$$$. And for the last sample test:
$$$$$$F_{50} = 12586269025 \equiv 586268941 \pmod {10^9 + 7}$$$$$$
Name |
---|