#include <bits/stdc++.h>
using namespace std;
const long long LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<long long> x(n);
  for (int i = 0; i < (n); ++i) cin >> x[i];
  vector<long long> kai(n);
  kai[0] = 1;
  for (long long i = 1; i < n; ++i) {
    kai[i] = kai[i - 1] * (i + 1);
    kai[i] %= mod;
  }
  long long ans = 0;
  long long cnt = kai[n - 2];
  for (int i = 0; i < (n - 1); ++i) {
    if (i > 0) {
      cnt += (kai[i - 1] * (kai[n - 2] / kai[i]));
      cnt %= mod;
    }
    ans += (cnt * (x[i + 1] - x[i]));
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
