Fibonacci GCD
Difficulty: Hard

Fibonacci numbers have the following form:  
$$F_1 = 1 \\\
F_2 = 1 \\\
F_3 = 2 \\\
\vdots \\\
F_n = F_{n-2}+F_{n-1}$$  

We have an array $a_1, a_2, \ldots, a_N$ which contains $N$ elements.   

We want to find $\gcd(F_{a_1},F_{a_2},F_{a_3}, \cdots ,F_{a_N} )$.  

**Input Format**  
The first line contains $N$, where $N$ denotes size of the array.  
Each of the next $N$ lines contains a number: the $i^{\text{th}}$ line contains $a_i$.

**Output Format**  
Print a single integer — the remainder of the division of the resulting number by $10^9+7$.  

**Constraints**  
$1 \le N \le 2 \times 10^5$   
$1 \le a_i \le 10^{12}$  


**Sample Input 1**

    3
    2
    3
    5

**Sample Output 1**

    1

**Explanation 1**  
$F_2 = 1$  
$F_3 = 2$  
$F_5 = 5$   
$\gcd(1,2,5)=1$  


**Sample Input 2**

    2
    3
    6

**Sample Output 2**

    2

**Explanation 2**  
$F_3 = 2$  
$F_6 = 8$  
$\gcd(2,8)=2$  





Input Format:

Output Format:

Sample Input:

Sample Output:

Python 3 starter code:
#
# Complete the 'solve' function below.
#
# The function is expected to return an INTEGER.
# The function accepts LONG_INTEGER a as parameter.
#

def solve(a):
    # Write your code here




Reference solution (Python):
###Python 2  
```python  
from fractions import gcd
mod = 10**9+7
class _:
    def __init__(a, x=0, y=0): a.x, a.y = x, y
    __add__ = lambda a, b: _((a.x+b.x)%mod, (a.y+b.y)%mod)
    __mul__ = lambda a, b: _((a.x*b.x+5*a.y*b.y)%mod, (a.x*b.y+a.y*b.x)%mod)
    __pow__ = lambda a, b: a if b == 1 else a*a**(b-1) if b&1 else (a*a)**(b>>1)
print(_(mod+1>>1,mod+1>>1)**reduce(gcd,(input() for i in xrange(input())))).y*2%mod
```