Fast Fibonacci in Mathematics

Please share the code for this question. I have tried numerous methods to solve this but only 1 test case is passing.

Thanks a lot but I didn’t quite get the logic behind the code. :sweat_smile:

You can read here.
https://codeforces.com/blog/entry/14385