#include <bits/stdc++.h>
using namespace std;
int N;
long long a[200002];
long long coef[200002], coef2[200002];
long long fac[200002];
long long inv_fac[200002];
const long long MOD = 1000000007;
long long modinv(long long a, long long mod) {
  long long e = mod - 2;
  long long res = 1;
  while (e > 0) {
    if (e % 2 == 1) res = (res * a) % mod;
    a = (a * a) % mod;
    e /= 2;
  }
  return res;
}
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) scanf("%lld", &a[i]);
  fac[0] = 1;
  for (int i = 1; i <= 200000; i++) fac[i] = (fac[i - 1] * i) % MOD;
  inv_fac[200000] = modinv(fac[200000], MOD);
  for (int i = 200000 - 1; i >= 0; i--)
    inv_fac[i] = (inv_fac[i + 1] * (i + 1)) % MOD;
  if (N % 2 == 0) {
    for (int i = 0; i < N; i++)
      coef[i] = (((fac[N / 2 - 1] * inv_fac[i / 2]) % MOD) *
                 inv_fac[N / 2 - (i / 2) - 1]) %
                MOD;
    if (N % 4 == 0) {
      for (int i = 1; i < N; i += 2) coef[i] *= -1;
    }
  } else if (N % 4 == 1) {
    for (int i = 0; i < N; i++)
      coef[i] =
          (((fac[N / 2] * inv_fac[i / 2]) % MOD) * inv_fac[N / 2 - (i / 2)]) %
          MOD;
    for (int i = 1; i < N; i += 2) coef[i] = 0;
  } else {
    for (int i = 0; i < N; i++)
      coef2[i] = (((fac[N / 2 - 1] * inv_fac[i / 2]) % MOD) *
                  inv_fac[N / 2 - (i / 2) - 1]) %
                 MOD;
    for (int i = 1; i < N; i++) {
      if (i % 2 == 1)
        coef[i] = (coef2[i] + coef2[i - 1]) % MOD;
      else
        coef[i] = (coef2[i] - coef2[i - 1]) % MOD;
    }
    coef[0] = 1;
  }
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    ans += a[i] * coef[i];
    ans %= MOD;
    ans = (ans + MOD) % MOD;
  }
  printf("%lld\n", ans);
  return 0;
}
