#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
const long long mod = 1000000007ll;
int n;
long long x[N], f[N][N], inv[N], fac[N], ans = 0ll;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &x[i]);
  fac[0] = 1ll;
  for (int i = 1; i < n; i++) fac[i] = fac[i - 1] * i % mod;
  inv[1] = 1ll;
  for (int i = 2; i <= n; i++) inv[i] = (mod / i) * (mod - inv[mod % i]) % mod;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n - i; j++) {
      f[i][j] = 0ll;
      if (i && j) {
        f[i][j] = inv[i + j - 1];
        f[i][j] = (f[i][j] + f[i - 1][j] * i % mod * inv[i + j - 1]) % mod;
        f[i][j] =
            (f[i][j] + f[i][j - 1] * (j - 1) % mod * inv[i + j - 1]) % mod;
      }
    }
  }
  for (int i = 1; i < n; i++)
    ans =
        (ans + f[i][n - i] * fac[n - 1] % mod * (x[i + 1] - x[i]) % mod) % mod;
  printf("%lld\n", ans);
  return 0;
}
