#include <iostream>
using namespace std;
#define MOD 1000000007
typedef long long ll;

int main() {
  int n;
  cin >> n;
  int x[n];
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }

  ll a[n], p = 1;
  a[1] = 1;
  for (int i = 2; i < n; i++) {
    p = p * (i-1) % MOD;
    a[i] = (a[i-1] * i + p) % MOD;
  }

  ll b[n];
  b[n-1] = 1;
  for (int i = n-2; i > 0; i--) {
    b[i] = b[i+1] * (i+1) % MOD;
  }

  ll ans = 0;
  for (int i = 1; i < n; i++) {
    ans += (x[i]-x[i-1]) * (a[i]*b[i]%MOD) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}