#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:36777216")
using namespace std;
static const int inf = 1000000009;
static const long long inf_ll = 1000000009000000009ll;
static const double eps = 1.0E-8;
static long long gcd(long long x, long long y) {
  return y == 0 ? x : gcd(y, x % y);
}
static long long pwm(long long x, long long n, long long m) {
  long long r = 1;
  while (n) {
    if (n & 1) r = r * x % m;
    x = x * x % m;
    n >>= 1;
  }
  return r;
}
const int N = 200005;
const long long p = 1e9 + 7;
long long a[N], niyuan[N], b[N], c[N];
int solve() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  niyuan[1] = 1;
  int u = n / 2 - 1;
  for (int i = 2; i <= n; i++) niyuan[i] = (p - p / i) * niyuan[p % i] % p;
  b[1] = b[2] = 1;
  for (int i = 2; i <= n / 2 + 1; i++) {
    b[i * 2 - 1] = (b[i * 2 - 3] * (u - i + 2)) % p;
    b[i * 2 - 1] = (b[i * 2 - 1] * niyuan[i - 1]) % p;
    b[i * 2] = b[i * 2 - 1];
  }
  if ((n / 2) % 2 == 0) {
    for (int i = 1; i <= n / 2; i++) b[i * 2] = -b[i * 2];
  }
  if (n % 2) {
    memcpy(c, b, sizeof(b));
    int base = 1;
    for (int i = 2; i <= n; i++) {
      b[i] = (c[i] + base * c[i - 1]) % p;
      base = -base;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans = (ans + (a[i] * b[i]) % p + p) % p;
  printf("%I64d\n", ans);
  return 0;
  return 0;
}
int main(int argc, char* argv[]) {
  ::std::ios::sync_with_stdio(false);
  ::std::cin.tie(0);
  ::std::cout.tie(0);
  int t = 1;
  while (t--) solve();
}
