#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}
long long MOD = 1000000007;
struct Edge {
  int src, dst;
  long long weight;
};
int N;
long long hoge[114514];
long long bik[114514];
long long bikinv[114514];
long long gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long extgcd(long long a, long long b, long long &x, long long &y) {
  long long g = a;
  x = 1;
  y = 0;
  if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
  return g;
}
long long invMod(long long a, long long m) {
  long long x, y;
  if (extgcd(a, m, x, y) == 1)
    return (x + m) % m;
  else
    return 0;
}
void bikcal(int NN) {
  long long hoge = (long long)1;
  bik[0] = (long long)1;
  bikinv[0] = (long long)1;
  for (int i = 1; i <= NN; i++) {
    hoge = (hoge * i) % MOD;
    bik[i] = hoge;
    bikinv[i] = invMod(bik[i], MOD);
  }
}
long long Comb(int a, int b) {
  long long ret;
  ret = (((bik[a] * bikinv[b]) % MOD) * bikinv[a - b]) % MOD;
  return ret;
}
long long powMod(long long x, long long k, long long m) {
  if (k == 0) return 1;
  if (k % 2 == 0)
    return powMod(x * x % m, k / 2, m);
  else
    return x * powMod(x, k - 1, m) % m;
}
int main() {
  cin >> N;
  for (int(i) = 0; (i) < (int)(N); ++(i)) cin >> hoge[i];
  long long ans = 0;
  bikcal(N);
  long long sum = 0;
  for (int(i) = 0; (i) < (int)(N - 2); ++(i)) {
    sum += hoge[N - 2 - i] - hoge[i];
    long long len = sum;
    len *= bik[N - 1];
    len %= MOD;
    len *= invMod(i + 1, MOD);
    len %= MOD;
    len *= invMod(i + 2, MOD);
    len %= MOD;
    ans += len;
    ans %= MOD;
  }
  for (int(i) = 0; (i) < (int)(N - 1); ++(i)) {
    long long len = hoge[N - 1] - hoge[N - i - 2];
    len *= bik[N - 1];
    len %= MOD;
    len *= invMod(i + 1, MOD);
    len %= MOD;
    ans += len;
    ans %= MOD;
  }
  cout << ans << endl;
}
