#include <bits/stdc++.h>
using namespace std;
long long powmod(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  long long mod = pow(10, 9) + 7;
  long long re_x;
  cin >> re_x;
  long long base = 1;
  for (long long i = 2; i < N; i++) {
    base *= i;
    base %= mod;
  }
  long long plus = base;
  long long mul_plus = 1;
  long long div_plus = 2;
  long long count = 0;
  for (long long i = 1; i < N; i++) {
    long long x;
    cin >> x;
    long long dis = x - re_x;
    re_x = x;
    count += (base * dis % mod);
    count %= mod;
    plus *= mul_plus % mod;
    plus %= mod;
    plus /= div_plus % mod;
    plus %= mod;
    mul_plus++;
    div_plus++;
    base += plus;
    base %= mod;
  }
  cout << count << endl;
}
