#include <bits/stdc++.h>
template <class C>
C& mini(C& a, C b) {
  if (b < a) a = b;
  return a;
}
template <class C>
C& maxi(C& a, C b) {
  if (a < b) a = b;
  return a;
}
using namespace std;
template <typename T>
void read(T& x) {
  x.read();
}
template <typename T>
void read(vector<T>& v) {
  for (T& x : v) read(x);
}
template <typename X, typename Y>
void read(pair<X, Y>& p) {
  read(p.first);
  read(p.second);
}
template <>
void read(int& x) {
  scanf("%d", &x);
}
template <>
void read(unsigned int& x) {
  scanf("%u", &x);
}
template <>
void read(long long& x) {
  scanf("%lld", &x);
}
template <>
void read(unsigned long long& x) {
  scanf("%llu", &x);
}
template <typename T>
void readv(vector<T>& v) {
  int N;
  read(N);
  v.resize(N);
  read(v);
}
template <typename T, typename... Ts>
void read(T& x, Ts&... args) {
  read(x);
  read(args...);
}
template <typename T>
void imfix(T& r) {
  if (r >= 1000000007) r -= 1000000007;
}
template <typename T>
T mfix(T r) {
  return r >= 1000000007 ? r - 1000000007 : r;
}
static int fact[100002];
static int ifact[100002];
int mpow(int a, int b) {
  long long r = 1;
  long long c = a;
  if (b == 0) return 1;
  while (b > 1) {
    if (b & 1) r = r * c % 1000000007;
    c = c * c % 1000000007;
    b >>= 1;
  }
  return r * c % 1000000007;
}
static int inv(int a) { return mpow(a, 1000000007 - 2); }
static void initfact() {
  fact[0] = 1;
  for (int i = 1; i < sizeof(fact) / sizeof(fact[0]); i++)
    fact[i] = (long long)i * fact[i - 1] % 1000000007;
}
static std::vector<int> calcD(const std::vector<int>& A) {
  std::vector<int> ret;
  ret.reserve(A.size());
  for (int l = 1; l < A.size(); l++) {
    long long r = 0;
    for (int i = l; i < A.size(); i++) {
      r += A[i] + 1000000007 - A[i - l];
    }
    ret.push_back(r % 1000000007);
  }
  return ret;
}
static std::vector<int> calcP(int N) {
  std::vector<int> ret;
  ret.reserve(N);
  for (int i = 1; i <= N; i++)
    ret.push_back((long long)fact[N] * inv(i) % 1000000007 * inv(i + 1) %
                  1000000007);
  return ret;
}
int main(int argc, const char* argv[]) {
  initfact();
  std::vector<int> A;
  readv(A);
  int N = A.size() - 1;
  auto D = calcD(A);
  auto P = calcP(N);
  long long ret = 0;
  assert(D.size() == P.size());
  for (int i = 0; i < D.size(); i++)
    ret = (ret + (long long)D[i] * P[i]) % 1000000007;
  for (int i = 0; i < N; i++) {
    int m = N - i;
    long long dist = A[N] - A[i];
    ret = (ret + dist * ((long long)fact[N] * inv(m) % 1000000007 + 1000000007 -
                         P[m - 1])) %
          1000000007;
  }
  printf("%lld\n", ret);
  return 0;
}
