#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
template <typename T>
class Factorial {
 public:
  vector<T> fact;
  vector<T> factinv;
  Factorial(int N);
  static T bipow(T c, T n);
  static T square(T n);
  T conv(T n, T m) const;
  T perm(T n, T m) const;
};
template <typename T>
Factorial<T>::Factorial(int N) : fact(N + 1), factinv(N + 1) {
  fact[0] = 1;
  for (int i = 1; i < N + 1; i++) {
    fact[i] = fact[i - 1] * static_cast<T>(i) % MOD;
  }
  factinv[N] = bipow(fact[N], MOD - 2);
  for (int i = N; i > 0; i--) {
    factinv[i - 1] = factinv[i] * static_cast<T>(i) % MOD;
  }
}
template <typename T>
T Factorial<T>::bipow(T c, T n) {
  if (n == 0) {
    return 1;
  } else if (n == 1) {
    return c;
  } else if (n % 2 == 0) {
    return square(bipow(c, n / 2)) % MOD;
  } else {
    return (static_cast<T>(c) * square(bipow(c, (n - 1) / 2))) % MOD;
  }
}
template <typename T>
T Factorial<T>::square(T n) {
  return static_cast<long long>(n) * n % MOD;
}
template <typename T>
T Factorial<T>::conv(T n, T m) const {
  if (n < m) {
    return 0;
  }
  return (((static_cast<long long>(fact[n]) * factinv[m]) % MOD) *
          factinv[n - m]) %
         MOD;
}
template <typename T>
T Factorial<T>::perm(T n, T m) const {
  if (n < m) {
    return 0;
  }
  return (static_cast<long long>(fact[n]) * factinv[n - m]) % MOD;
}
void solve(long long N, std::vector<long long> x) {
  vector<long long> v(N - 1);
  vector<long long> s(N - 1);
  Factorial<long long> f(static_cast<int>(N) + 1);
  for (int i = 0; i < N - 1; ++i) {
    s[i] = x[i + 1] - x[i];
  }
  v[0] = 1LL;
  long long t, k;
  long long ret = 0LL;
  k = f.fact[N - 1];
  for (long long i = 0; i < N - 2; ++i) {
    ret += (((v[i] * k % MOD) * s[i]) % MOD);
    ret %= MOD;
    v[i + 1] = (v[i] * (i + 2)) % MOD;
    v[i + 1] += f.fact[i + 1];
    v[i + 1] %= MOD;
    k *= f.factinv[i + 2];
    k *= f.fact[i + 1];
    k %= MOD;
  }
  ret += (((v[N - 2] % MOD) * s[N - 2]) % MOD);
  ret %= MOD;
  std::cout << ret << std::endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> x(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &x[i]);
  }
  solve(N, std::move(x));
  return 0;
}
