#include <bits/stdc++.h>
using namespace std;
long long pow(long long x, long long id) {
  if (id == 1) {
    return x;
  }
  long long temp = pow((x * x) % (1000000007ll), id / 2);
  if (id % 2) {
    temp *= x;
    temp %= (1000000007ll);
  }
  return temp;
}
long long inv(long long x) { return pow(x, (1000000007ll) - 2); }
int main() {
  long long a[200005], temp;
  long long n;
  scanf(" %lld", &n);
  n--;
  long long x = n - n % 4ll;
  a[0] = 1;
  for (int i = 1; 2 * i <= x; i++) {
    a[2 * i - 1] = 0;
    a[2 * i] = a[2 * (i - 1)] * (x / 2 - i + 1);
    a[2 * i] %= (1000000007ll);
    a[2 * i] *= inv(i);
    a[2 * i] %= (1000000007ll);
  }
  temp = n % 4;
  if (temp > 0) {
    for (int i = 1; i <= x + 1; i += 2) {
      a[i] = a[i - 1];
    }
    temp--;
  }
  if (temp > 0) {
    a[x + 2] = 0;
    for (int i = x + 2; i >= 1; i -= 2) {
      a[i] = a[i] - a[i - 1];
      a[i - 1] = a[i - 1] + a[i - 2];
      a[i] %= (1000000007ll);
      a[i - 1] %= (1000000007ll);
    }
    temp--;
  }
  if (temp > 0) {
    a[x + 3] = 0;
    for (int i = x + 2; i >= 2; i -= 2) {
      a[i + 1] = a[i] - a[i + 1];
      a[i] = a[i - 1] + a[i];
      a[i] %= (1000000007ll);
      a[i + 1] %= (1000000007ll);
    }
    a[1] = a[0] - a[1];
  }
  long long sum = 0ll;
  for (int i = 0; i <= n; i++) {
    scanf(" %lld", &temp);
    sum += (temp * a[i]) % (1000000007ll);
    sum %= (1000000007ll);
  }
  printf("%lld\n", (sum + (1000000007ll)) % (1000000007ll));
  return 0;
}
