#include <bits/stdc++.h>
using namespace std;
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
long long n, x[100001], memo[100001], M[100001], ans;
long long kr(long long N, long long K) {
  long long res;
  if (N == K)
    res = memo[N - 1];
  else
    res =
        ((memo[N]) * modinv(K * (K + 1), 1000000007) % 1000000007) % 1000000007;
  res = (res * M[n - N]) % 1000000007;
  return res;
}
signed main() {
  memo[0] = 1;
  for (long long i = 1; i <= (long long)(100001); ++i)
    memo[i] = (memo[i - 1] * i) % 1000000007;
  cin >> n;
  if (n > 2000) return 0;
  M[1] = 1;
  for (long long i = 2; i < (long long)(n); ++i)
    M[i] = (M[i - 1] * (n - i + 1)) % 1000000007;
  for (long long i = 1; i <= (long long)(n); ++i) cin >> x[i];
  for (long long i = 1; i <= (long long)(n - 1); ++i) {
    for (long long j = 1; j <= (long long)(i); ++j) {
      ans = (ans + kr(i, j) * (x[n - i + j] - x[n - i])) % 1000000007;
    }
  }
  cout << ans << endl;
}
