#include <bits/stdc++.h>
using namespace std;
template <class A>
void pr(A a) {
  cout << (a) << endl;
}
template <class A, class B>
void pr(A a, B b) {
  cout << a << " ";
  pr(b);
}
template <class A, class B, class C>
void pr(A a, B b, C c) {
  cout << a << " ";
  pr(b, c);
}
template <class A, class B, class C, class D>
void pr(A a, B b, C c, D d) {
  cout << a << " ";
  pr(b, c, d);
}
template <class T>
inline bool chmin(T& a, T b) {
  return a > b ? a = b, true : false;
}
template <class T>
inline bool chmax(T& a, T b) {
  return a < b ? a = b, true : false;
}
template <uint32_t mod>
struct ModInt {
  uint32_t a;
  ModInt& s(uint32_t vv) {
    a = vv < mod ? vv : vv - mod;
    return *this;
  }
  ModInt(int64_t x = 0) { s(x % mod + mod); }
  ModInt& operator+=(const ModInt& x) { return s(a + x.a); }
  ModInt& operator-=(const ModInt& x) { return s(a + mod - x.a); }
  ModInt& operator*=(const ModInt& x) {
    a = uint64_t(a) * x.a % mod;
    return *this;
  }
  ModInt& operator/=(const ModInt& x) {
    *this *= x.inv();
    return *this;
  }
  ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
  ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
  ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
  ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
  bool operator==(const ModInt& x) const { return a == x.a; }
  bool operator!=(const ModInt& x) const { return a != x.a; }
  bool operator<(const ModInt& x) const { return a < x.a; }
  ModInt operator-() const { return ModInt() - *this; }
  ModInt pow(int64_t n) const {
    ModInt res(1), x(*this);
    while (n) {
      if (n & 1) res *= x;
      x *= x;
      n >>= 1;
    }
    return res;
  }
  ModInt inv() const { return pow(mod - 2); }
};
template <uint32_t mod>
istream& operator>>(istream& in, ModInt<mod>& a) {
  return (in >> a.a);
}
template <uint32_t mod>
ostream& operator<<(ostream& out, const ModInt<mod>& a) {
  return (out << a.a);
}
using mint = ModInt<((long long)(1e9 + 7))>;
int factorial(int n) {
  static map<int, int> fa;
  fa[0] = 1;
  if (fa.count(n) == 0) {
    fa[n] = (int)((long long)n * factorial(n - 1) % ((long long)(1e9 + 7)));
    return fa[n];
  } else
    return fa[n];
}
int main(void) {
  long long N;
  cin >> N;
  vector<long long> x(N);
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }
  mint kai(1);
  for (int i = 1; i < N; i++) {
    kai *= mint(i);
  }
  vector<mint> t(N - 1);
  t[0] = factorial(N - 2);
  mint tf(factorial(N - 1));
  for (int i = 2; i < N; i++) {
    t[i - 1] = tf / (mint(N - i) * mint(N - i + 1));
  }
  reverse(t.begin(), t.end());
  mint ans;
  for (int i = 0; i < int(N - 1); ++i) {
    mint tmp;
    int id = 0;
    for (int j = i + 1; j < N; j++) {
      mint ttt;
      if (j == (N - 1)) {
        for (int kk = id; kk < N - 1; kk++) {
          ttt += t[kk];
        }
      } else {
        ttt += t[id];
      }
      ans += ttt * mint(x[j] - x[i]);
      id++;
    }
  }
  pr(ans);
}
