#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
long long int ExGCD(long long int a, long long int b, long long int &x,
                    long long int &y) {
  long long int d = a;
  x = 1;
  y = 0;
  if (b != 0) {
    d = ExGCD(b, a % b, y, x);
    y -= a / b * x;
  }
  return d;
}
long long int inverse(long long int a) {
  long long int x, y;
  ExGCD(a, mod, x, y);
  return x > 0 ? x : mod + x;
}
long long int fact[300001];
long long int inv[300001];
void maketable() {
  fact[0] = 1;
  for (int i = 0; i < 300000; i++) {
    fact[i + 1] = fact[i] * (i + 1) % mod;
  }
  long long int y;
  for (int i = 0; i < 300000; i++) {
    ExGCD(fact[i], mod, inv[i], y);
    while (inv[i] < 0) inv[i] += mod;
  }
}
long long int nCr(long long int n, long long int r) {
  return fact[n] * inv[n - r] % mod * inv[r] % mod;
}
long long int modpow(long long int a, long long int p) {
  long long int ret = 1;
  for (int i = 63; i >= 0; i--) {
    ret *= ret;
    ret %= mod;
    if ((1LL << i & p) != 0) {
      ret *= a;
      ret %= mod;
    }
  }
  return ret;
}
int main() {
  maketable();
  int n;
  cin >> n;
  vector<long long int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long int> w(n);
  w[0] = 0;
  for (int i = 0; i < n - 1; i++) {
    w[i + 1] = a[i + 1] - a[i];
  }
  for (int i = 0; i < n; i++) {
    w[i + 1] += w[i];
  }
  long long int ans = 0;
  long long int cost = 0;
  int r = n - 2, l = 0;
  for (int i = 0; i < n - 2; i++) {
    cost += w[r] - w[l] + mod;
    cost %= mod;
    long long int prob = fact[i] * inv[i + 2] % mod;
    ans += cost * prob % mod;
    ans %= mod;
    r--;
    l++;
  }
  for (int i = 0; i < n - 1; i++) {
    long long int cost = w[n - 1] - w[i];
    cost %= mod;
    long long int prob = fact[n - 2 - i] * inv[n - 1 - i] % mod;
    ans += cost * prob % mod;
    ans %= mod;
  }
  ans = ans * fact[n - 1] % mod;
  cout << ans << endl;
  return 0;
}
