#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1e16;
const long double EPS = 1e-10;
const long double PI = 3.141592653589793;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
const pair<long long, long long> fd[] = {make_pair(1, 0), make_pair(-1, 0),
                                         make_pair(0, 1), make_pair(0, -1)};
vector<long long> divisor(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (n / i != i) ret.push_back(n / i);
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}
map<long long, long long> prime_factor(long long n) {
  map<long long, long long> ret;
  for (long long i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) {
    ret[n] = 1;
  }
  return ret;
}
long long n, x[110000];
signed main() {
  cin >> n;
  for (long long i = (0); i < (n); i++) cin >> x[i];
  long long t = 1, ans = 0, s = 0;
  for (long long i = (1); i < (n); i++) {
    s = (s + x[i] - x[0]) % MOD;
  }
  for (long long i = (0); i < (n); i++) {
    ans = (ans + (s * t % MOD)) % MOD;
    s = (s - (n - i - 1) * (x[i + 1] - x[i]) + MOD * n) % MOD;
    t *= n - i - 1;
  }
  cout << ans << endl;
}
