#include <bits/stdc++.h>
 
#define rep(...) overload_rep(__VA_ARGS__, rep_1, rep_0) (__VA_ARGS__)
#define rep_0(i, end) for (int i = 0; i < (end); ++i)
#define rep_1(i, fr, ba) for (int i = (fr); i <= (ba); ++i)
#define overload_rep(arg_0, arg_1, arg_2, name, ...) name
#define all(box) box.begin(), box.end()
 
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }

template <int MODULUS = 1000000007>
struct modulo_int {
private:

  long long value;
  constexpr void normalize() {
    value %= MODULUS;
    if (value < 0) value += MODULUS;
  }

public:

  constexpr modulo_int(const long long& value_ = 0) : value(value_) { normalize(); }
  constexpr modulo_int operator - () const { return modulo_int(MODULUS - value); }
  constexpr modulo_int operator ~ () const { return modulo_int(*this) << (MODULUS - 2); }
  constexpr const long long& operator () () const { return value; }

  constexpr modulo_int operator + (const modulo_int& rhs) const { return modulo_int(*this) += rhs; }
  constexpr modulo_int& operator += (const modulo_int& rhs) {
    if ((value += rhs.value) >= MODULUS) value -= MODULUS;
    return (*this);
  }

  constexpr modulo_int operator - (const modulo_int& rhs) const { return modulo_int(*this) -= rhs; }
  constexpr modulo_int& operator -= (const modulo_int& rhs) {
    if ((value += MODULUS - rhs.value) >= MODULUS) value -= MODULUS;
    return (*this);
  }

  constexpr modulo_int operator * (const modulo_int& rhs) const { return modulo_int(*this) *= rhs; }
  constexpr modulo_int& operator *= (const modulo_int& rhs) {
    (value *= rhs.value) %= MODULUS;
    return (*this);
  }

  constexpr modulo_int operator / (const modulo_int& rhs) const { return modulo_int(*this) /= rhs; }
  constexpr modulo_int& operator /= (const modulo_int& rhs) {
    return (*this) *= ~rhs;
  }

  constexpr modulo_int operator << (const long long& shift) const {
    modulo_int result(1), mult(*this);
    for (long long t = shift; t > 0; t >>= 1) {
      if (t & 1) result *= mult;
      mult *= mult;
    }
    return result;
  }

  friend std::istream& operator >> (std::istream& stream, modulo_int& lhs) {
    stream >> lhs.value;
    lhs.normalize();
    return stream;
  }

  friend std::ostream& operator << (std::ostream& stream, const modulo_int& rhs) {
    return stream << rhs.value;
  }

};

template <int MODULUS = 1000000007>
struct modulo_fact {

  std::vector<modulo_int<MODULUS>> fact;
  std::vector<modulo_int<MODULUS>> ifact;

  modulo_fact(const int& size = 200000) : fact(size + 1), ifact(size + 1) {
    fact[0] = 1;
    for (int i = 1; i <= size; ++i) {
      fact[i] = fact[i - 1] * i;
    }
    ifact[size] = ~fact[size];
    for (int i = size; i > 0; --i) {
      ifact[i - 1] = ifact[i] * i;
    }
  }

  modulo_int<MODULUS> operator () (const int& n, const int& r) const {
    return fact[n] * ifact[r] * ifact[n - r];
  }

  modulo_int<MODULUS> perm(const int& n, const int& r) const {
    return fact[n] * ifact[n - r];
  }

};

using modint = modulo_int<>;
modulo_fact<> modfact;

int main() {

  int N;
  std::cin >> N;
  std::vector<int> X(N);
  rep (i, N) std::cin >> X[i];

  modint ans;
  rep (i, N - 1) {
    rep (j, i + 1, N - 2) {
      modint coeff = ~modint(j - i + 1) * ~modint(j - i);
      ans += modint(X[j] - X[i]) * coeff;
    }
    ans += modint(X[N - 1] - X[i]) / modint(N - 1 - i);
  }

  std::cout << ans * modfact.fact[N - 1] << '\n';
  return 0;

}
