#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
template <typename T>
inline bool chmax(T &a, const T &b) {
  if (a >= b) {
    return false;
  }
  a = b;
  return true;
}
template <typename T>
inline bool chmin(T &a, const T &b) {
  if (a <= b) {
    return false;
  }
  a = b;
  return true;
}
int n;
vector<long long> x;
long long kaijo(int x) { return x ? (x * kaijo(x - 1)) % mod : 1; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cin >> n;
  x.resize(n);
  for (long long i = (long long)0; i < (long long)n; i++) cin >> x[i];
  long long sum = 0, num = kaijo(n - 1);
  for (long long i = (long long)0; i < (long long)n - 1; i++) {
    sum += num * (x[n - 1] - x[i]);
    num = num * (i + 1) / (i + 2);
    num %= mod;
    sum %= mod;
  }
  cout << sum << endl;
}
