#include <bits/stdc++.h>
using namespace std;
template <typename Iter>
ostream& _out(ostream& s, Iter a, Iter b) {
  for (auto it = a; it != b; it++) s << (it == a ? "" : " ") << *it;
  return s;
}
template <typename A, typename B>
ostream& operator<<(ostream& s, pair<A, B>& p) {
  return s << "(" << p.first << " , " << p.second << ")";
}
template <typename T>
ostream& operator<<(ostream& s, vector<T>& v) {
  return _out(s, v.begin(), v.end());
}
inline long long rit() {
  int key = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') key = -1;
    c = getchar();
  }
  long long x = 0;
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * key;
}
int __ = 1;
const long long mod = 1e9 + 7;
vector<long long> operator+(vector<long long> v1, vector<long long> v2) {
  for (int i = 0; i < v1.size(); i++) {
    v1[i] += v2[i];
  }
  return v1;
}
vector<long long> operator-(vector<long long> v1, vector<long long> v2) {
  for (int i = 0; i < v1.size(); i++) {
    v1[i] -= v2[i];
  }
  return v1;
}
vector<long long> solve(int n) {
  vector<long long> a[110][110];
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < n; j++) a[n][i].push_back(0);
    a[n][i][i - 1] = 1;
  }
  int key = 1;
  for (int i = n - 1; i >= 1; i--) {
    for (int j = 1; j <= i; j++) {
      if (key)
        a[i][j] = a[i + 1][j] + a[i + 1][j + 1];
      else
        a[i][j] = a[i + 1][j] - a[i + 1][j + 1];
      key ^= 1;
    }
  }
  return a[1][1];
}
long long fac[200010];
long long inv[200010];
long long my_pow(long long a, long long n) {
  if (n == 0) return 1;
  long long x = my_pow(a, n / 2);
  x = x * x % mod;
  if (n & 1) x = x * a;
  return x % mod;
}
void init() {
  fac[0] = inv[0] = 1;
  for (int i = 1; i <= 200000; i++) {
    fac[i] = fac[i - 1] * i;
    fac[i] %= mod;
    inv[i] = my_pow(fac[i], mod - 2);
  }
}
int main() {
  int n;
  cin >> n;
  vector<long long> table;
  for (int i = 1; i <= n; i++) {
    long long val;
    scanf("%lld", &val);
    table.push_back(val);
  }
  if (n <= 4) {
    vector<long long> v = solve(n);
    int ans = 0;
    for (int i = 0; i < v.size(); i++) {
      ans += (v[i] * table[i]) % mod;
      ans %= mod;
    }
    cout << (ans + mod) % mod << endl;
    return 0;
  }
  int key = 1;
  long long ans = 0;
  init();
  while (1) {
    if (n % 4 == 0) {
      for (int i = 0; i < n; i++) {
        ans += table[i] * fac[n / 2 - 1] % mod * inv[i / 2] % mod *
               inv[n / 2 - 1 - i / 2] * (i % 2 == 0 ? 1 : -1);
        ans %= mod;
      }
      break;
    } else if (n % 4 == 1) {
      for (int i = 0; i < n; i++) {
        if (i % 2 == 1) continue;
        ans += table[i] * fac[n / 2] % mod * inv[i / 2] % mod *
               inv[n / 2 - i / 2] % mod;
        ans %= mod;
      }
      break;
    } else if (n % 4 == 3) {
      vector<long long> table2;
      for (int i = 0; i < n - 1; i++) {
        table2.push_back(table[i] + table[i + 1] * key);
        table2[i] %= mod;
        key *= -1;
      }
      for (int i = 0; i < n - 1; i++) table[i] = table2[i];
      n--;
    } else if (n % 4 == 2) {
      for (int i = 0; i < n; i++) {
        ans += table[i] * fac[n / 2 - 1] % mod * inv[i / 2] % mod *
               inv[n / 2 - 1 - i / 2] % mod;
        ans %= mod;
      }
      break;
    }
  }
  printf("%lld\n", (ans + mod) % mod);
  return 0;
}
