#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;
const int CASES = 3;
void solve() {
  ll n;
  cin >> n;
  vector<ll> a(n), dist(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n - 1; ++i) {
    dist[i] = a[i + 1] - a[i];
  }
  ll total = 1;
  for (int i = 0; i < (n - 1); ++i) {
    total *= (i + 1);
  }
  ll ans = total * (a[n - 1] - a[0]);
  ll tmp = total / (n - 1);
  ll step = 0;
  for (ll i = 1; i < n; ++i) {
    ll pre = step;
    step += (total / (n - 1)) / (i + 1);
    ans +=
        ((pre * (i + 1)) + (total / (n - 1)) + (step * (n - 2 - i))) * dist[i];
    ans %= MOD;
  }
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
