#include <bits/stdc++.h>
namespace lib {
using namespace std;
class fastio {
 private:
  char _num[111], _ch;
  int _f, _head;
  bool _useSTD;

 public:
  inline void ioSTD() {
    _useSTD = 1;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
  }
  inline void gc(char& _c) {
    if (_useSTD)
      cin >> _c;
    else
      _c = getchar();
  }
  inline void pc(char _c) {
    if (_useSTD)
      cout << _c;
    else
      putchar(_c);
  }
  template <typename _T>
  inline fastio& operator-(_T& _x) {
    if (_useSTD)
      cin >> _x;
    else {
      _x = 0;
      while (!isdigit(_ch)) _f |= _ch == '-', gc(_ch);
      while (isdigit(_ch)) _x = (_x << 1) + (_x << 3) + (_ch ^ 48), gc(_ch);
      _f && (_x = -_x, _f = 0);
    }
    return *this;
  }
  template <typename _T>
  inline fastio& operator+(_T _x) {
    if (_useSTD)
      cin >> _x;
    else {
      _T _k;
      if (_x == 0) {
        pc('0'), pc(' ');
        return *this;
      }
      if (_x < 0) pc('-'), _x = -_x;
      while (_x > 0)
        _k = _x / 10, ++_head, _num[_head] = (_x - (_k << 1) - (_k << 3)) ^ 48,
        _x = _k;
      while (_head > 0) pc(_num[_head]), --_head;
      pc(' ');
    }
    return *this;
  }
  template <typename _T>
  inline fastio& operator>>(_T& _x) {
    cin >> _x;
    return *this;
  }
  template <typename _T>
  inline fastio& operator<<(_T _x) {
    cout << _x;
    return *this;
  }
  fastio() { _f = 0, _head = 0, _useSTD = 0, _ch = ' '; }
} io;
inline void fileio(string _r, string _w) {
  if (_r[0] != '-') freopen(_r.c_str(), "r", stdin);
  if (_w[0] != '-') freopen(_w.c_str(), "w", stdout);
}
}  // namespace lib
using namespace lib;
long long powm(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) (res *= a) %= 1000000007LL;
    (a *= a) %= 1000000007LL;
    b >>= 1;
  }
  return res;
}
long long x[100005], fact[100005];
signed main() {
  long long n;
  long long ans = 0;
  io - n;
  for (register int i = 1; i <= n; ++i) io - x[i];
  fact[0] = 1;
  for (register int i = 1; i <= n; ++i)
    fact[i] = fact[i - 1] * i % 1000000007LL;
  for (register int i = 1; i < n; ++i)
    for (register int j = i + 1; j <= n; ++j)
      (ans += (x[j] - x[i]) * fact[j - i - 1] % 1000000007LL * fact[n - 1] %
              1000000007LL *
              powm(fact[min((long long)j, n - 1) - i + 1], 1000000007LL - 2) %
              1000000007LL) %= 1000000007LL;
  io + ans;
  return 0;
}
