#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main(void) {
  long long N;
  cin >> N;
  vector<long long> X(N);
  for (long long i = 0; i < N; i++) {
    cin >> X[i];
  }
  vector<long long> dis(N);
  for (long long i = 1; i < N; i++) {
    dis[i] = X[N - i] - X[N - i - 1];
  }
  vector<long long> res(N, 0);
  vector<long long> TT(N, 1);
  for (long long i = 1; i < N; i++) {
    long long times = 1;
    for (long long j = 0; j < i; j++) {
      times = (times * (i - j)) % mod;
      long long a = (times / (j + 1)) % mod;
      long long plus = (TT[i - j] * dis[j + 1]) % mod;
      plus = (plus * a) % mod;
      res[i] = (res[i] + plus) % mod;
    }
    for (long long j = 0; j < i; j++) {
      res[j] = (res[j] * i) % mod;
    }
    TT[i] = (TT[i - 1] * i) % mod;
  }
  long long fres = 0;
  for (long long i = 0; i < N; i++) {
    fres = (fres + res[i]) % mod;
  }
  cout << fres << endl;
  return 0;
}
