#include <bits/stdc++.h>
using namespace std;
int get() {
  char c;
  while (c = getchar(), c != '-' && (c < '0' || c > '9'))
    ;
  bool flag = (c == '-');
  if (flag) c = getchar();
  int x = 0;
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return flag ? -x : x;
}
const int MOD = 1000000007;
const int MAXN = 200000;
int x[MAXN];
long long fac[MAXN + 1], inv[MAXN + 1];
long long binom(int n, int m) {
  return fac[n] * inv[m] % MOD * inv[n - m] % MOD;
}
long long Pow(long long a, int b) {
  if (!b) return 1;
  long long t = Pow(a * a % MOD, b / 2);
  if (b & 1) t = t * a % MOD;
  return t;
}
int main() {
  fac[0] = 1;
  for (int i = 1; i <= MAXN; i++) fac[i] = fac[i - 1] * i % MOD;
  inv[MAXN] = Pow(fac[MAXN], MOD - 2);
  for (int i = MAXN; i >= 1; i--) inv[i - 1] = inv[i] * i % MOD;
  int n = get();
  for (int i = 0; i < n; i++) x[i] = get();
  if (n == 1) {
    cout << x[0] << endl;
    return 0;
  }
  long long m = (long long)n * (n - 1) / 2;
  if (n & 1) {
    for (int i = 1; i < n; i++)
      if (i & 1)
        x[i - 1] = (x[i - 1] + x[i]) % MOD;
      else
        x[i - 1] = (x[i - 1] - x[i]) % MOD;
    n--;
  }
  long long a = 0, b = 0;
  for (int i = 0; i < n; i++) {
    long long tmp = x[i];
    tmp = tmp * binom(n / 2 - 1, i / 2) % MOD;
    if (~i & 1)
      a = (a + tmp) % MOD;
    else
      b = (b + tmp) % MOD;
  }
  long long ans;
  if (m & 1)
    ans = (a + b) % MOD;
  else
    ans = (a - b) % MOD;
  if (ans < 0) ans += MOD;
  cout << ans << endl;
  return 0;
}
