#include <bits/stdc++.h>
using namespace std;
const long long maxn = 100005, mod = 1e9 + 7;
long long jiecheng[maxn], inv[maxn], X[maxn], n, ans, x, y;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
inline void write(long long a) {
  if (a < 0) {
    char a = '-', b = '1';
    putchar(a);
    putchar(b);
  } else {
    if (a >= 10) write(a / 10);
    putchar(a % 10 + '0');
  }
}
void Euclidean_EX(long long a, long long b) {
  if (b == 0) {
    x = 1;
    y = 0;
    return;
  }
  Euclidean_EX(b, a % b);
  long long temp = x;
  x = y;
  y = temp - a / b * y;
}
signed main() {
  n = read();
  jiecheng[0] = 1;
  for (long long i = 1; i <= 100000; ++i)
    jiecheng[i] = jiecheng[i - 1] * i % mod;
  Euclidean_EX(jiecheng[100000], mod);
  inv[100000] = x;
  for (long long i = 100000 - 1; i >= 1; --i)
    inv[i] = inv[i + 1] * (i + 1) % mod;
  inv[0] = 1;
  for (long long i = 1; i <= n; ++i) X[i] = read();
  for (long long i = 1; i < n; ++i)
    for (long long j = i + 1; j <= n; ++j) {
      if (j == n)
        ans = (ans + (X[j] - X[i]) % mod * jiecheng[j - i - 1] % mod *
                         jiecheng[n - 1] % mod * inv[j - i] % mod) %
              mod;
      else
        ans = (ans + (X[j] - X[i]) % mod * jiecheng[j - i - 1] % mod *
                         jiecheng[n - 1] % mod * inv[j - i + 1] % mod) %
              mod;
    }
  cout << ans;
  return 0;
}
