#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
template <typename T>
static ostream& operator<<(ostream& stream, const vector<T>& t);
template <typename T>
static istream& read(T, T, istream& = cin);
template <typename T>
static istream& operator>>(istream& stream, vector<T>& t) {
  return read((t).begin(), (t).end(), stream);
}
template <typename T>
static istream& read(T b, T e, istream& stream) {
  for (T it = b; it != e; ++it) stream >> *it;
  return stream;
}
template <typename T>
static T ext_euclid(T a, T b, T c, T d) {
  if (c == T(0)) return b;
  return ext_euclid(c, d, a % c, b - a / c * d);
}
template <typename T>
static T mod_inverse(T x, T mod = T(MOD)) {
  return (ext_euclid(mod, T(0), x, T(1)) + mod) % mod;
}
long long mod_inverse(int x, long long mod = MOD) {
  return mod_inverse<long long>(x, mod);
}
struct Factorial {
  vector<long long> fact, ifact;
  long long comb(long long n, long long m) {
    assert(n >= m);
    assert(n < long long(fact.size()));
    return fact[n] * ifact[m] % MOD * ifact[n - m] % MOD;
  }
  Factorial(int n) {
    fact.resize(n + 1);
    ifact.resize(n + 1);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i % MOD;
    ifact[n] = mod_inverse(fact[n]);
    for (int i = n - 1; i >= 0; --i) ifact[i] = (i + 1) * ifact[i + 1] % MOD;
  }
};
struct _print {
  string sep, end;
  bool space;
  ostream& stream;
  _print(string _sep = " ", string _end = "\n", ostream& _stream = cout)
      : sep(_sep), end(_end), space(false), stream(_stream) {}
  ~_print() { stream << end; }
  template <typename T>
  _print& operator,(const T& t) {
    if (space) stream << sep;
    space = true;
    stream << t;
    return *this;
  }
};
void __() {
  int n;
  cin >> n;
  vector<long long> w(n + 10);
  w[1] = 0;
  w[2] = 2;
  w[3] = 9;
  for (int i = 2; i <= n + 5; ++i) {
    w[i + 2] = -((i * i % MOD * i + 3 * i * i + 2 * i) % MOD * w[i] +
                 (-5 * i - 2 * i * i - 2) % MOD * w[i + 1]) %
               MOD * mod_inverse(i + 1) % MOD;
    if (w[i + 1] < 0) w[i + 1] += MOD;
  }
  vector<long long> a(n);
  cin >> a;
  long long ans = 0;
  Factorial f(n + 1);
  for (int i = 0; i < n - 1; ++i) {
    ans += w[i + 2] * (a[i + 1] - a[i]) % MOD * f.ifact[i + 2] % MOD;
    ans %= MOD;
  }
  ans = ans * f.fact[n - 1] % MOD;
  _print(), ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);
  __();
}
