#include <bits/stdc++.h>
using namespace std;
using Complex = complex<double>;
using ll = long long;
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x(x % 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 fact[101010];
mint sum[101010];
mint modpow(ll a, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return (mint)res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  vector<ll> x(N);
  for (ll i = 0; i < N; i++) cin >> x[i];
  for (int i = 0; i < N; i++) sum[i + 1] = sum[i] + x[i];
  fact[0] = 1;
  for (ll i = 1; i < 101010; i++) fact[i] = fact[i - 1] * i;
  mint ans = 0;
  for (ll k = 2; k < N; k++) {
    mint temp = fact[N - 1] * modpow(k * (k - 1), mod - 2);
    mint sum1 = (sum[N - 1] - sum[k - 1]);
    mint sum2 = (sum[N - k] - sum[0]);
    sum1 -= sum2;
    temp *= sum1;
    ans += temp;
  }
  for (ll k = 2; k <= N; k++) {
    mint temp = fact[N - 1] * modpow(k - 1, mod - 2);
    temp *= (x[N - 1] - x[N - k]);
    ans += temp;
  }
  cout << ans.x << endl;
  return 0;
}
