#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 10;
const int MOD = 1e9 + 7;
long long int a[M], p = 1, sgn = 1, ans, n, fact[M];
long long int pw(long long int a, long long int b) {
  if (b == 0) return 1LL;
  long long int x = pw(a, b / 2LL);
  if (b % 2 == 1) return (((x * x) % MOD) * a) % MOD;
  return (x * x) % MOD;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  while (n-- % 4 != 1)
    for (int i = 1; i <= n; i++)
      a[i] = (a[i] + sgn * a[i + 1] + MOD) % MOD, sgn *= -1;
  ans = a[1];
  for (int i = 1; i <= n / 2; i++)
    p = p * (n / 2 - i + 1) % MOD * pw(i, MOD - 2) % MOD,
    ans = (ans + p * a[i * 2 + 1]) % MOD;
  cout << ans;
}
