#include <bits/stdc++.h>
using namespace std;
const long long INF = (1 << 30) - 1;
const long long LLINF = (1LL << 60LL);
const long long MOD = 1000000007;
const long long mod = 998244353;
const long long MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
long long dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
struct Timer {
  chrono::system_clock::time_point start, end;
  Timer() { start = chrono::system_clock::now(); }
  ~Timer() {
    end = chrono::system_clock::now();
    auto msec =
        chrono::duration_cast<chrono::milliseconds>(end - start).count();
    cerr << "time : " << msec << " ms" << endl;
  }
};
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  long long n;
  cin >> n;
  long long x[100010];
  for (long long i = 0; i < n; i++) {
    cin >> x[i];
  }
  long long m[100010];
  m[1] = 1, m[0] = 1;
  for (long long i = 1; i < n + 1; i++) {
    m[i + 1] = m[i] * (i + 1) % MOD;
  }
  long long s[2010][2010];
  s[1][1] = 1;
  s[0][0] = 1;
  for (long long i = 2; i < n + 1; i++) {
    s[i][0] = 0, s[i][i] = 1;
    for (long long j = 1; j < i; j++) {
      s[i][j] = s[i - 1][j - 1] + (i - 1) * s[i - 1][j];
    }
  }
  vector<long long> v;
  for (long long i = 0; i < n - 1; i++) {
    v.push_back(x[i + 1] - x[i]);
  }
  long long ans = 0;
  m[n - 2] = 1;
  long long now = n - 1;
  for (long long i = n - 2 - 1; i >= 0; i--) {
    m[i] = m[i + 1] * now % MOD;
    now--;
  }
  for (long long i = 0; i < n - 1; i++) {
    for (long long j = 0; j < n - 1; j++) {
      ans += s[i + 1][j + 1] % MOD * m[i] % MOD * (j + 1) % MOD * v[i] % MOD;
      ans %= MOD;
    }
  }
  cout << ans << endl;
  return 0;
}
