#include <bits/stdc++.h>
using namespace std;
long long de[100005];
long long d0[100005];
int main() {
  long long n;
  cin >> n;
  long long x[n];
  for (int i = 0; i < (int)(n); i++) {
    cin >> x[i];
  }
  d0[2] = 1;
  de[2] = 1;
  d0[3] = 2;
  de[3] = 3;
  for (long long i = 4; i <= n; i++) {
    d0[i] = d0[i - 1] * (i - 1);
    d0[i] %= (int)(1e9 + 7);
    de[i] = d0[i - 1] + de[i - 1] * (i - 1);
    de[i] %= (int)(1e9 + 7);
  }
  long long ans = 0;
  for (int i = 0; i < (int)(n - 1); i++) {
    ans += d0[n] * de[i + 2] / d0[i + 2] * (x[i + 1] - x[i]);
    ans %= (int)(1e9 + 7);
  }
  cout << ans << endl;
  return 0;
}
