#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
long long ans = 0;
int main() {
  int n;
  cin >> n;
  vector<long long> x(n);
  int a;
  for (int i = 0; i < n; i++) {
    int b;
    cin >> b;
    x[i] = b;
  }
  long long ans = 0;
  long long L[n + 1];
  L[0] = 1;
  for (int i = 1; i <= n; i++) {
    L[i] = (L[i - 1] * i) % mod;
  }
  for (int i = 0; i < n - 1; i++) {
    ans = (ans + L[n - 1] * (x[i + 1] - x[i])) % mod;
    for (int j = 0; j < i; j++) {
      ans = (ans + L[n - 1] / (j + 2) * (x[i + 1] - x[i])) % mod;
    }
  }
  cout << ans << endl;
}
