#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long INF = 214748364700000000;
double EPS = 1e-12;
double PI = 3.141592653589793238;
template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}
using Graph = vector<vector<long long>>;
long long F[100010];
long long fact(long long x) {
  if (x == 0) return F[0] = 1;
  if (F[x] != 0) return F[x];
  F[x] = fact(x - 1) * x % MOD;
  return F[x];
}
long long modpow(long long a, long long n, long long m) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % m;
    a = a * a % m;
    n >>= 1;
  }
  return res;
}
int main() {
  long long m = fact(100001);
  long long N;
  cin >> N;
  vector<long long> X(N);
  for (long long i = (long long)0; i < (long long)N; i++) cin >> X[i];
  long long coeff = 0, ans = 0;
  for (long long i = (long long)1; i < (long long)N; i++) {
    coeff += (F[N - 1] * modpow(i, MOD - 2, MOD)) % MOD;
    ans += (X[i] - X[i - 1]) * coeff;
  }
  cout << ans << endl;
}
