#include <bits/stdc++.h>   using namespace std;   long long n, fact[200001], a[200005];   long long power(long long a, long long b) {     if (b == 0) return 1;     long long p = power(a, b / 2);     p = ((p % 1000000007) * (p % 1000000007)) % 1000000007;     if (b & 1) {       return (a * p) % 1000000007;     }     return p;   }   long long mod_inv(long long n, long long m) {     long long div = power((fact[n - m] * fact[m]) % 1000000007, 1000000007 - 2);     return (fact[n] * div) % 1000000007;   }   int main() {     fact[0] = 1;     for (int i = 1; i <= 200000; i++) {       fact[i] = (fact[i - 1] * i) % 1000000007;     }     scanf( %lld , &n);     for (int i = 0; i < n; i++) {       scanf( %lld , &a[i]);     }     long long ans = 0;     if (n % 4 == 0) {       n = n - 2;       n /= 2;       for (int i = 0; i < n * 2 + 2; i++) {         if (i & 1) {           ans -= ((mod_inv(n, i / 2)) * a[i]) % 1000000007;           ans = (ans + 1000000007) % 1000000007;         } else {           ans += ((mod_inv(n, i / 2)) * a[i]) % 1000000007;           ;           ans = (ans + 1000000007) % 1000000007;         }       }     } else if (n % 4 == 1) {       long long sz = n;       n = n - 1;       n /= 2;       for (int i = 0; i < sz; i += 2) {         ans += ((mod_inv(n, i / 2)) * a[i]) % 1000000007;         ans = (ans + 1000000007) % 1000000007;       }     } else if (n % 4 == 2) {       long long sz = n;       n = n - 2;       n /= 2;       for (int i = 0; i < sz; i++) {         ans += ((mod_inv(n, i / 2)) * a[i]) % 1000000007;         ;         ans = (ans + 1000000007) % 1000000007;       }     } else {       long long sz = n;       n = n - 3;       n /= 2;       ans = (a[0] * mod_inv(n, 0)) % 1000000007;       for (int i = 1; i < sz; i++) {         if (i & 1) {           ans += (2 * (mod_inv(n, i / 2)) * a[i]) % 1000000007;           ;           ans = ans = (ans + 1000000007) % 1000000007;         } else {           ans +=               ((mod_inv(n, i / 2) - mod_inv(n, (i / 2) - 1)) * a[i]) % 1000000007;           ans = (ans + 1000000007) % 1000000007;         }       }     }     cout << ans << endl;     return 0;   }   