Helper function that calculates F [ ] [ ] raise to the power n and puts the result in F [ ] [ ] Note that this function is designed only for fib ( ) and won 't work as general power function
void power ( long long F [ 2 ] [ 2 ] , long long n , long long m ) { if ( n == 0 n == 1 ) return ; long long M [ 2 ] [ 2 ] = { { 1 , 1 } , { 1 , 0 } } ; power ( F , n / 2 , m ) ; multiply ( F , F , m ) ; if ( n % 2 != 0 ) multiply ( F , M , m ) ; }