#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
template <class T>
inline void chmax(T& a, const T& b) {
  if ((a) < (b)) (a) = (b);
}
template <class T>
inline void chmin(T& a, const T& b) {
  if ((a) > (b)) (a) = (b);
}
template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast {
  Fast() {
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
long long mod = 1e9 + 7;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    (x += a.x) %= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    (x += mod - a.x) %= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/=(const mint& rhs) { return *this *= rhs.inv(); }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint operator/(const mint& rhs) const { return mint(*this) /= rhs; }
  mint pow(long long n) const {
    mint res(1), x(*this);
    if (n < 0) {
      n = -n;
      x = (*this).inv();
    }
    while (n) {
      if (n & 1) res *= x;
      x *= x;
      n >>= 1;
    }
    return res;
  }
  mint inv() const { return pow(mod - 2); }
  friend ostream& operator<<(ostream& os, const mint& m) { return os << m.x; }
  bool operator<(const mint& r) const { return x < r.x; }
  bool operator==(const mint& r) const { return x == r.x; }
};
const long long MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (long long i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % mod;
    inv[i] = mod - inv[mod % i] * (mod / i) % mod;
    finv[i] = finv[i - 1] * inv[i] % mod;
  }
}
long long COM(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
signed main() {
  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];
  }
  42;
  COMinit();
  mint ans = 0;
  for (long long j = (long long)((n)-1); j >= (long long)(1); --j) {
    for (long long i = (long long)(0); i < (long long)(j); ++i) {
      ans += fac[n - 1] / (j - i) * (x[j] - x[j - 1]);
    }
    42;
  }
  cout << ans << endl;
  return 0;
}
