#include <bits/stdc++.h>
using namespace std;
long long D = 1000000000 + 7;
vector<long long> f;
void fa(int n) {
  vector<long long> ff(n, 1);
  for (int i = 2; i < n; i++) {
    ff.at(i) = (ff.at(i - 1) * i) % D;
  }
  f = ff;
}
int main() {
  int N;
  cin >> N;
  fa(N);
  vector<int> x(N);
  for (int i = 0; i < N; i++) {
    cin >> x.at(i);
  }
  vector<vector<long long>> V(N, vector<long long>(N, 1));
  for (int i = 1; i < N - 1; i++) {
    V.at(i).at(0) = V.at(i - 1).at(0) * (N - i);
    for (int j = 1; j < i; j++) {
      V.at(i).at(j) = V.at(i - 1).at(j) * (N - i) + V.at(i - 1).at(j - 1);
    }
  }
  for (int i = 0; i < N - 1; i++) {
    for (int j = 0; j <= i; j++) {
      V.at(i).at(j) = V.at(i).at(j) * f.at(N - 1 - i) % D;
    }
  }
  long long total = 0;
  for (int i = 0; i < N - 1; i++) {
    long long t = x.at(N - 1) - x.at(i);
    long long h = 0;
    for (int j = 0; j < N - i - 1; j++) {
      h += V.at(j).at(i);
      h = h % D;
    }
    total += long long(long double(h * t) / long double(N - i - 1)) % D;
    total = total % D;
  }
  cout << total << endl;
  return 0;
}
