#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> x(n);
  for (int i = 0; i < n; ++i) cin >> x[i];
  long long kaijou = 1;
  for (int i = 1; i <= n - 1; ++i) kaijou *= i;
  vector<long long> count(n);
  count[0] = 0;
  for (int i = 1; i <= n - 1; ++i) count[i] = count[i - 1] + kaijou / i;
  long long d[n];
  d[0] = 0;
  for (int i = 1; i <= n - 1; ++i) d[i] = (x[i] - x[i - 1]) % MOD;
  long long ans = 0;
  for (int i = 1; i <= n - 1; ++i) ans += (d[i] * count[i]) % MOD;
  cout << ans % MOD;
}
