#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long con[200005];
long long con2[200005];
long long all[200005];
long long Pow(long long N, long long M) {
  if (M == 0) return 1;
  long long t = Pow(N, M / 2);
  t = t * t % MOD;
  if (M % 2) t = t * N % MOD;
  return t;
}
long long C(long long N, long long M) {
  return con[N] * con2[M] % MOD * con2[N - M] % MOD;
}
int main() {
  long long N, M, i, j, k, t = 0, ok = 0, a, b, l, r, x, y, z;
  scanf("%lld", &N);
  con[0] = 1;
  con2[0] = 1;
  for (i = 0; i < N; i++) scanf("%d", &all[i]);
  for (i = 1; i <= N; i++) {
    con[i] = con[i - 1] * i % MOD;
    con2[i] = Pow(con[i], MOD - 2);
  }
  if (N % 2 == 0) {
    x = 0;
    y = 0;
    for (i = 0; i < N; i += 2) {
      x += C(N / 2 - 1, i / 2) * all[i] % MOD;
      x %= MOD;
    }
    for (i = 1; i < N; i += 2) {
      y += C(N / 2 - 1, i / 2) * all[i] % MOD;
      y %= MOD;
    }
    if (N % 4 == 0)
      printf("%lld\n", (x - y + MOD) % MOD);
    else
      printf("%lld\n", (x + y + MOD) % MOD);
  } else if (N % 4 == 1) {
    x = 0;
    for (i = 0; i < N; i += 2) {
      x += C(N / 2, i / 2) * all[i] % MOD;
      x %= MOD;
    }
    printf("%lld\n", x % MOD);
  } else {
    x = 0;
    for (i = 0; i < N - 2; i += 2) {
      x += C(N / 2 - 1, i / 2) * all[i] % MOD;
      x %= MOD;
    }
    y = 0;
    for (i = 1; i < N; i += 2) {
      y += C(N / 2 - 1, i / 2) * all[i] % MOD;
      y %= MOD;
    }
    z = 0;
    for (i = 2; i < N; i += 2) {
      z += C(N / 2 - 1, i / 2 - 1) * all[i] % MOD;
      z %= MOD;
    }
    printf("%lld\n", (x + 2 * y - z + MOD) % MOD);
  }
  return 0;
}
