#include <bits/stdc++.h>
using namespace std;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec) is >> x;
  return is;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for (int i = 0; i < (int)vec.size(); i++)
    os << vec[i] << (i + 1 == (int)vec.size() ? "" : ", ");
  os << "}";
  return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  for (auto &&itr : map_var) {
    os << *itr;
    itr++;
    if (itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  for (auto &&itr : set_var) {
    os << *itr;
    itr++;
    if (itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
void dump_func() { cerr << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&...tail) {
  cerr << head;
  if (sizeof...(Tail) > 0) cerr << ", ";
  dump_func(std::move(tail)...);
}
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
using vec = std::vector<T>;
template <class T>
void print(const T &x) {
  cout << x << "\n";
}
const long long MOD = 1000000007, INF0 = 1061109567, INF = INF0 * INF0;
const double EPS = 1e-10, PI = acos(-1.0);
const long long dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
long long x[200100];
long long dif[200100];
long long mR[200100];
const long long FACTSIZE = 100100;
long long fact[FACTSIZE];
long long revfact[FACTSIZE];
long long binpow(long long a, long long b, long long mo) {
  if (a >= mo) a %= mo;
  long long ans = 1;
  do {
    if (b & 1) ans = 1ll * ans * a % mo;
    a = 1ll * a * a % mo;
  } while (b >>= 1);
  return ans;
}
long long modInv(long long p) {
  if (p >= MOD) p %= MOD;
  return binpow(p, MOD - 2, MOD);
}
long long ncr(long long n, long long r) {
  if (n < r) return 0;
  long long rs = fact[n] * revfact[r];
  if (rs >= MOD) rs %= MOD;
  rs *= revfact[n - r];
  if (rs >= MOD) rs %= MOD;
  return rs;
}
void init() {
  fact[0] = 1, revfact[0] = 1;
  for (long long i = 1; i < FACTSIZE; ++i) {
    fact[i] = fact[i - 1] * i % MOD;
    revfact[i] = binpow(fact[i], MOD - 2, MOD);
  }
}
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  long long N;
  init();
  cin >> N;
  for (long long i = 0; i < N; i++) cin >> x[i];
  if (N == 2) {
    print(x[1] - x[0]);
    return 0;
  }
  for (long long i = 0; i < N - 1; i++) {
    dif[i] = x[i + 1] - x[i];
  };
  long long sum = 1;
  for (long long i = 1; i <= N - 1; i++) {
    sum *= i, sum %= MOD;
  }
  for (long long i = 1; i <= N; i++) {
    mR[i] = modInv(i);
  }
  long long d = sum * mR[2];
  d %= MOD;
  long long dd = sum + (MOD - d);
  dd %= MOD;
  long long tmp = sum;
  tmp %= MOD;
  ;
  long long ans = 0;
  for (long long i = 0; i < N - 1; i++) {
    ;
    ans += dif[i] * tmp;
    ans %= MOD;
    tmp += dd;
    tmp %= MOD;
    dd *= (i + 2) * mR[i + 3];
    dd %= MOD;
  }
  print(ans);
}
