#include <bits/stdc++.h>
using namespace std;
vector<long long> factmemo, factmemoInv;
long long factmemoMod = -1;
long long factorial(int n, int M) {
  if (factmemoMod == M) return factmemo[n];
  if (n <= 1) return 1;
  long long res = 1;
  for (int i = 1; i <= n; i++) res = res * i % M;
  return res;
}
long long power(long long k, long long n, int M) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * k % M;
    k = k * k % M;
    n /= 2;
  }
  return res;
}
void initFactorial(int n, int M) {
  factmemo.assign(n + 1, 0);
  factmemoInv.assign(n + 1, 0);
  factmemoMod = M;
  factmemo[0] = 1;
  for (int i = 1; i <= n; i++) factmemo[i] = factmemo[i - 1] * i % M;
  factmemoInv[n] = power(factmemo[n], M - 2, M);
  for (int i = n; i > 0; i--) factmemoInv[i - 1] = factmemoInv[i] * i % M;
}
long long C(int n, int m, int M) {
  if (n < m) return 0;
  if (m == 0 || n == m) return 1;
  if (factmemoMod == M)
    return factmemo[n] * factmemoInv[m] % M * factmemoInv[n - m] % M;
  long long numer = factorial(n, M);
  long long denom = factorial(m, M) * factorial(n - m, M) % M;
  denom = power((int)denom, M - 2, M);
  return numer * denom % M;
}
long long P(int n, int m, int M) {
  if (n < m) return 0;
  if (m == 0) return 1;
  if (factmemoMod == M) return factmemo[n] * factmemoInv[n - m] % M;
  long long numer = factorial(n, M);
  long long denom = factorial(n - m, M);
  denom = power((int)denom, M - 2, M);
  return numer * denom % M;
}
long long H(int n, int m, int M) {
  if (n == 0 && m == 0) return 1;
  return C(n + m - 1, m, M);
}
int main() {
  int N;
  long long x[200010];
  scanf("%d", &N);
  initFactorial(N, 1000000007);
  for (int i = 0; i < N; i++) {
    scanf("%lld", x + i);
  }
  long long t = 0, ans = 0;
  long long A = 0, B = 1;
  for (int i = 1; i < N; i++) {
    long long d = (x[i] - x[i - 1]);
    A = (A * i + B) % 1000000007;
    B = B * i;
    ;
    ;
    ans += A % 1000000007 * d % 1000000007 * factmemo[N - i - 1] % 1000000007 *
           C(N - 1, i, 1000000007) % 1000000007;
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
