#include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
const long long mod = 1000000000 + 7;
int a[maxn];
int n, k, m;
long long comb[200010];
long long pow(long long x, long long n, long long mod) {
  long long a = 1;
  while (n) {
    if (n & 1) a = a * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return a;
}
long long reverse(long long x, long long mod) { return pow(x, mod - 2, mod); }
void getComb(int n) {
  memset(comb, 0, sizeof(comb));
  comb[0] = 1;
  for (int i = 1; i <= n; ++i)
    comb[i] = comb[i - 1] * (n - i + 1) % mod * reverse(i, mod) % mod;
}
long long solve(int n, int i) {
  long long ans;
  if (i > n) return 0;
  if ((n - 1) % 4 == 0) {
    if (i % 2 == 0) return 0;
    return comb[(i - 1) / 2];
  } else {
    if (n % 2 == 0)
      return (solve(n - 1, i - 1) +
              (long long)((i - 1) % 2 ? -1 : 1) * solve(n - 1, i)) %
             mod;
    return ((long long)(i % 2 ? -1 : 1) * solve(n - 1, i - 1) +
            solve(n - 1, i)) %
           mod;
  }
}
int get() {
  if (scanf("%d", &n) != 1) return 0;
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  int m = n;
  while ((m - 1) % 4) --m;
  getComb((m - 1) / 2);
  long long ans = 0;
  for (int i = 1; i <= n; ++i) ans = (ans + solve(n, i) * a[i]) % mod;
  cout << (ans + mod) % mod << endl;
  return 1;
}
int main() {
  get();
  return 0;
}
