#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
inline void judge() {
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
}
const int maxn = 200005;
const int mod = 1e9 + 7;
int n, fac[maxn], facinv[maxn];
inline int powmod(int a, int b) {
  int res = 1;
  for (; b; b >>= 1) {
    if (b & 1) res = 1ll * res * a % mod;
    a = 1ll * a * a % mod;
  }
  return res;
}
inline void prprpr() {
  fac[0] = 1;
  for (int i = (1); i <= (n); i++) fac[i] = 1ll * fac[i - 1] * i % mod;
  facinv[n] = powmod(fac[n], mod - 2);
  for (int i = (n - 1); i >= (0); i--)
    facinv[i] = 1ll * facinv[i + 1] * (i + 1) % mod;
}
inline int C(int n, int m) {
  return 1ll * fac[n] * facinv[m] % mod * facinv[n - m] % mod;
}
int op[maxn];
int ne[maxn];
inline void gen1(int n) {
  for (int i = (1); i <= (n); i++) op[i] = C((n / 2 - 1), (i + 1) / 2 - 1);
  if (n % 4 == 0) {
    for (int i = (1); i <= (n); i++)
      if (i % 2 == 0) op[i] = mod - op[i];
  }
}
inline void gen2(int n) {
  int rev = 1;
  ne[1] = 1;
  for (int i = (2); i <= (n); i++) {
    if (rev) {
      ne[i] = (op[i - 1] + op[i]) % mod;
    } else {
      ne[i] = (op[i] - op[i - 1] + mod) % mod;
    }
    rev ^= 1;
  }
}
int main() {
  read(n);
  prprpr();
  gen1(n / 2 * 2);
  if (n & 1) {
    gen2(n);
    for (int i = (1); i <= (n); i++) op[i] = ne[i];
  }
  int res = 0;
  for (int i = (1); i <= (n); i++) {
    int x;
    read(x);
    res = (res + 1ll * x * op[i]) % mod;
  }
  cout << res << endl;
}
