#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int modinv(int64_t a) {
  int64_t b = MOD, u = 1, v = 0;
  while (b) {
    int64_t t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= MOD;
  if (u < 0) u += MOD;
  return u;
}
int r(int64_t x) {
  int64_t c = x, d = 1;
  while (c > 1) {
    d *= c % MOD;
    d %= MOD;
    c--;
  }
  return d;
}
int sum(int64_t y) {
  int64_t u = y, v = 1;
  while (u > 1) {
    v += modinv(u) % MOD;
    v %= MOD;
    u--;
  }
  return v;
}
int main() {
  int64_t answer = 0, N;
  cin >> N;
  vector<int64_t> s(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> s.at(i);
    if (i > 0) {
      answer +=
          ((int)r(N - 1) * (s.at(i) - s.at(i - 1)) % MOD * (int)sum(i)) % MOD;
      answer %= MOD;
    }
  }
  cout << answer << endl;
}
