September challenge 2019-FIBEASY problem

i’am getting wrong answer for the fibeasy problem,i think i used the correct approach but i’am getting wrong answer.here is the link to the code.-https://www.codechef.com/viewsolution/26608127

Consider the test case:
1
8
Your ans is 3 but the code gives 8
The code will give wrong answers at n = 2^m
Also This will give SiGSEGV for n = 1e7 because out of bound

Read editorial FIBEASY - Editorial because
1.Calculating i (in function mul can be upto 10^18) and further you are calculation fib upto i which is wrong and also TLE.
2.for n=2^n it will give wrong answer.

I did the test case but the answer is 3 itself!..,bro can u help me out.