#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &val) {
  val = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    val = (val << 3) + (val << 1) + (c ^ 48);
    c = getchar();
  }
  val *= f;
}
template <typename T>
void write_(T val) {
  if (!val) return;
  write_(val / 10);
  putchar(val % 10 + 48);
}
template <typename T>
inline void write(T val) {
  if (val == 0)
    putchar(48);
  else if (val < 0) {
    putchar('-');
    write_(-val);
  } else
    write_(val);
}
const long long MOD = 1e9 + 7;
const int N = 1e5 + 5;
long long n, x[N], d[N], ans, fac = 1;
long long qpow(long long a, long long p) {
  long long res = 1;
  while (p) {
    if (p & 1) res = res * a % MOD;
    a = a * a % MOD;
    p >>= 1;
  }
  return res;
}
long long inv(long long x) { return qpow(x, MOD - 2); }
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (register long long i = 1; i <= n - 1; i++) {
    fac = fac * i % MOD;
  }
  for (register int i = 1; i <= n; i++) {
    cin >> x[i];
  }
  for (register int i = 1; i <= n; i++) {
    for (register int j = i + 1; j < n; j++) {
      ans = (ans + (fac * inv(j - i) % MOD - fac * inv(j - i + 1) % MOD + MOD) %
                       MOD * (x[j] - x[i]) % MOD) %
            MOD;
    }
    ans = (ans + fac * inv(n - i) % MOD * (x[n] - x[i]) % MOD) % MOD;
  }
  cout << ans << endl;
  return 0;
}
