Fibonacci Sum
Difficulty: Hard

The series defined below is called fibonacci series.

1,1,2,3,5,8

Recursively it is defined as follow:-

Fib[1]=1

Fib[2]=1

Fib[i]=Fib[i-1]+Fib[i-2] ,i>2

Let us define a function Sum(N)

Sum(N)=Fib[1]+Fib[2]+..Fib[N]

You are given the value of N, you need to out Sum(N)%1000000007

Input Format:
The only line of the input will contain N.

1<=N<=10^16

Output Format:
For each N print Sum(N)%1000000007 i.e the sum of the series(Fib[1]+Fib[2]+..Fib[N])%1000000007.

Sample Input:
    2


Sample Output:
    2


Python 3 starter code:


Reference solution (C++):
    #include <iostream>
    #include <cstdio>
    using namespace std;
    #define mod 1000000007
    #define rep(i,a,N) for(int i=a;i<N;++i)
    typedef long long ll;
 
    void multiply(ll F[2][2], ll M[2][2]){
       ll x =  (F[0][0]*M[0][0])%mod + (F[0][1]*M[1][0])%mod;
       ll y =  (F[0][0]*M[0][1])%mod + (F[0][1]*M[1][1])%mod;
       ll z =  (F[1][0]*M[0][0])%mod + (F[1][1]*M[1][0])%mod;
       ll w =  (F[1][0]*M[0][1])%mod + (F[1][1]*M[1][1])%mod;
 
       F[0][0] = x%mod;
       F[0][1] = y%mod;
       F[1][0] = z%mod;
       F[1][1] = w%mod;
    }
 
 
    void power(ll F[2][2], ll n){
      if( n == 0 || n == 1)
          return;
      ll M[2][2] = {{1,1},{1,0}};
 
      power(F, n/2);
      multiply(F, F);
 
      if (n%2 != 0)
         multiply(F, M);
    }
 
    ll fib(ll n){
      ll F[2][2] = {{1,1},{1,0}};
      if (n == 0)
        return 0;
      if(n==1 || n==2)
        return 1;
      power(F, n-1);
      return F[0][0];
    }
 

 
    int main()
    {
      int T;
      ll N;
      scanf("%lld",&N);
      printf("%lld\n", ((fib(N+2)+mod)%mod));
    }