#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010, mod = 1000000007;
inline long long read() {
  char ch = getchar();
  long long x = 0, f = 0;
  while (ch < '0' || ch > '9') f |= ch == '-', ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return f ? -x : x;
}
int n, x[maxn], fac[maxn], inv[maxn], invfac[maxn], ans;
int main() {
  n = read();
  for (int i = (1); i <= (n); i++) x[i] = read();
  fac[0] = fac[1] = inv[1] = invfac[0] = invfac[1] = 1;
  for (int i = (2); i <= (n); i++) {
    fac[i] = 1ll * fac[i - 1] * i % mod;
    inv[i] = mod - 1ll * (mod / i) * inv[mod % i] % mod;
    invfac[i] = 1ll * invfac[i - 1] * inv[i] % mod;
  }
  for (int i = (1); i <= (n); i++)
    for (int j = (i + 1); j <= (n); j++) {
      if (j != n)
        ans =
            (ans + 1ll * (x[j] - x[i]) * (inv[j - i] - inv[j - i + 1] + mod)) %
            mod;
      else
        ans = (ans + 1ll * (x[j] - x[i]) * inv[j - i]) % mod;
    }
  ans = 1ll * ans * fac[n - 1] % mod;
  printf("%d\n", ans);
}
