#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long fact[n + 1];
  fact[0] = 1;
  for (int i = 1; i <= n; i++) {
    fact[i] = (fact[i - 1] * i) % 1000000007;
  }
  long long x[n], diff[n - 1], suff[n - 1];
  for (int i = 0; i < n; i++) {
    cin >> x[i];
    if (i > 0) diff[i - 1] = (x[i] - x[i - 1]);
  }
  suff[n - 2] = diff[n - 2];
  for (int i = n - 3; i >= 0; i--) {
    suff[i] = (suff[i + 1] + diff[i]) % 1000000007;
  }
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    ans = (ans + ((suff[i - 1] * fact[n - i]) % 1000000007)) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
