#include <bits/stdc++.h>
using namespace std;
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(long long &x, long long y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(long long &x, long long y) { return (y > x) ? x = y, 1 : 0; }
const int N = 100000;
const int inf = (int)1e9 + 1;
const long long big = (long long)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int mod = (int)1e9 + 7;
const int mod1 = (int)1e9 + 9;
const int mod2 = 998244353;
const int mod3 = (int)1e6 + 3;
const long double eps = 1e-12;
const double pi = atan2(0, -1);
const int ABC = 26;
long long binary_search(vector<long long> arr, long long val, long long l,
                        long long r) {
  long long m = l + (r - l) / 2;
  if (l >= r) {
    return l;
  }
  if (val < arr[m]) {
    return binary_search(arr, val, l, m);
  } else {
    return binary_search(arr, val, m + 1, r);
  }
}
long long binary_search2(vector<long long> arr, long long val, long long l,
                         long long r) {
  long long m = l + (r - l) / 2;
  if (l >= r) {
    return l;
  }
  if (val <= arr[m]) {
    return binary_search2(arr, val, l, m);
  } else {
    return binary_search2(arr, val, m + 1, r);
  }
}
long long power(long long x, long long y) {
  long long res = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
long long modInverse(long long n) { return power(n, mod - 2); }
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  long long fact[n + 1];
  fact[0] = 1;
  long long x[n];
  int i;
  for (int i = (0); i < (n); i++) {
    if (i) {
      fact[i] = (fact[i - 1] * i) % mod;
    }
    cin >> x[i];
  }
  long long sum = 0;
  for (int i = (0); i < (n - 1); i++) {
    sum += ((x[n - 1] - x[i]) * modInverse(i + 1)) % mod;
  }
  sum = (sum * fact[n - 1]) % mod;
  cout << sum;
  return 0;
}
