#include <bits/stdc++.h>
const unsigned P = 1e9 + 7;
struct buf {
  operator unsigned() {
    register unsigned c = getchar(), x = 0;
    for (; !isdigit(c); c = getchar())
      ;
    for (; isdigit(c); c = getchar()) x = x * 10 - '0' + c;
    return x;
  }
} fio;
inline unsigned long long moc(unsigned long long a) {
  return a < P ? a : a - P;
}
inline unsigned long long mod(unsigned long long a) {
  return a < P ? a : a % P;
}
inline unsigned long long inv(unsigned long long a, unsigned k = P - 2) {
  static unsigned long long w;
  for (w = 1; k; a = mod(a * a), k >>= 1)
    if (k & 1) w = mod(w * a);
  return w;
}
int n, m, i;
unsigned long long r, s, a[200000], f[200000 / 2 + 1], g[200000 / 2 + 1];
int main() {
  n = fio;
  for (i = 0; i < n; ++i) a[i] = fio;
  f[0] = 1;
  for (i = 1; i <= n >> 1; ++i) f[i] = mod(f[i - 1] * i);
  g[n >> 1] = inv(f[n >> 1]);
  for (i = n >> 1; i >= 1; --i) g[i - 1] = mod(g[i] * i);
  switch (n & 3) {
    case 0:
      m = (n - 2) >> 1;
      for (i = 0; i < n >> 1; ++i)
        i& 1 ? s = moc(s - mod(a[i] * mod(g[i >> 1] * g[m - (i >> 1)])) + P)
             : s = mod(s + a[i] * mod(g[i >> 1] * g[m - (i >> 1)]));
      for (i = (n >> 1) - 1; i >= 0; --i)
        i& 1
            ? s = mod(s + a[n - i - 1] * mod(g[i >> 1] * g[m - (i >> 1)]))
            : s = moc(s - mod(a[n - i - 1] * mod(g[i >> 1] * g[m - (i >> 1)])) +
                      P);
      break;
    case 1:
      m = (n - 1) >> 1;
      for (i = 0; i < n; ++i)
        if (!(i & 1)) s = mod(s + a[i] * mod(g[i >> 1] * g[m - (i >> 1)]));
      break;
    case 3:
      --n;
      for (i = 0; i < n; ++i)
        a[i] = i & 1 ? moc(a[i] - a[i + 1] + P) : moc(a[i] + a[i + 1]);
    case 2:
      m = (n - 2) >> 1;
      for (i = 0; i < n; ++i)
        s = mod(s + a[i] * mod(g[i >> 1] * g[m - (i >> 1)]));
      break;
  }
  printf(
      "%llu"
      "\n",
      mod(s * f[m]));
  return 0;
}
