#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  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 pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
int main() {
  long long n;
  cin >> n;
  vector<long long> x;
  for (int i = 0; i < (int)(n); i++) {
    long long tmp;
    cin >> tmp;
    x.push_back(tmp);
  }
  vector<long long> sum;
  long long sum_cnt = 0;
  for (int i = 0; i < (int)(n + 1); i++) {
    sum.push_back(sum_cnt);
    sum_cnt += x[i];
  }
  cout << endl;
  mint ans_m(0);
  mint mut(1);
  for (long long i = 1; i < n; i++) {
    mint m(i);
    mut *= m;
  }
  for (int i = 0; i < (int)(n - 1); i++) {
    long long ip = i + 1;
    mint part_m(0);
    for (int j = ip; j < n; j++) {
      mint ppart_m(0);
      ppart_m += x[j] - x[i];
      ppart_m /= (j - i) * (j - i + 1);
      if (j == n - 1) ppart_m *= (j - i + 1);
      part_m += ppart_m;
    }
    part_m *= mut;
    ans_m += part_m;
  }
  cout << ans_m.x << endl;
}
