#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int MAX = 200000;
long long int fact[MAX + 1] = {0};
long long int inv[MAX + 1] = {0};
long long int exp(long long int x, long long int n, long long int p) {
  if (n == 0) {
    return 1;
  } else if (n == 1) {
    return x % p;
  } else {
    if (n % 2 == 0) {
      return (exp((x * x) % p, n / 2, p));
    } else {
      return (x * exp((x * x) % p, n / 2, p)) % p;
    }
  }
}
long long int inverse(long long int x) { return exp(x, mod - 2, mod); }
long long int nCr(long long int n, long long int r) {
  long long int res = fact[n];
  res *= inv[r];
  if (res >= mod) res %= mod;
  res *= inv[n - r];
  if (res >= mod) res %= mod;
  return res;
}
long long int p(long long int x) {
  if (x % 2) return -1;
  return 1;
}
long long int a[MAX + 1] = {0};
void solve() {
  long long int n;
  cin >> n;
  for (long long int j = 1; j <= n; j++) cin >> a[j];
  if (n == 1) {
    cout << a[1] << "\n";
    return;
  }
  vector<vector<long long int>> coeff(4);
  coeff[0].resize((n / 4) * 4 + 3 + 1, 0);
  coeff[1].resize((n / 4) * 4 + 3 + 1, 0);
  coeff[2].resize((n / 4) * 4 + 3 + 1, 0);
  coeff[3].resize((n / 4) * 4 + 3 + 1, 0);
  long long int d = (n / 4) * 4;
  long long int x = (d - 2) / 2;
  long long int i = 1;
  for (long long int j = 0; j <= x; j++) {
    coeff[0][i] = nCr(x, j);
    coeff[0][i + 1] = (-nCr(x, j) + mod) % mod;
    i += 2;
  }
  for (long long int md = 1; md <= 3; md++) {
    coeff[md][1] = 1;
    for (long long int i = 2; i <= (n / 4) * 4 + md; i++) {
      if (md % 2) {
        coeff[md][i] =
            (p(i) * coeff[md - 1][i - 1] + coeff[md - 1][i] + 3 * mod) % mod;
        if (coeff[md][i] >= mod) coeff[md][i] %= mod;
      } else {
        if (md == 2) {
          coeff[md][i] =
              (coeff[md - 1][i - 1] - coeff[md - 1][i] * p(i) + 3 * mod) % mod;
          if (coeff[md][i] >= mod) coeff[md][i] %= mod;
        }
      }
    }
  }
  long long int md = n % 4;
  long long int res = 0;
  for (long long int j = 1; j <= n; j++) {
    res += a[j] * coeff[md][j];
    if (res >= mod) res %= mod;
  }
  cout << res << "\n";
  return;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  t = 1;
  fact[0] = 1;
  inv[0] = 1;
  for (long long int j = 1; j <= MAX; j++) {
    fact[j] = fact[j - 1] * j;
    fact[j] %= mod;
    inv[j] = inverse(fact[j]);
  }
  while (t--) {
    solve();
  }
  return 0;
}
