#include <bits/stdc++.h>
using namespace std;
inline long long add(long long a, long long b) { return (a + b) % 1000000007; }
inline long long mul(long long a, long long b) { return (a * b) % 1000000007; }
long long qpow(long long a, long long b) {
  long long res = 1;
  for (long long i = 0; i < b; i++) res = mul(res, a);
  return res;
}
long long fact(long long a) {
  long long res = 1;
  for (long long i = 1; i <= a; i++) res = mul(res, a);
  return res;
}
int main() {
  int N = 0;
  cin >> N;
  vector<long long> position(N);
  for (int i = 0; i < N; i++) cin >> position[i];
  double expected_value = 0;
  vector<double> total_probability(N, 0.0);
  for (int i = 1; i < N; i++) {
    total_probability[i] = total_probability[i - 1] + 1.0 / i;
  }
  for (int i = 0; i < N - 1; i++) {
    expected_value +=
        (position[i + 1] - position[i]) * total_probability[i + 1];
  }
  long long ans = expected_value * fact(N - 1);
  ans = ans % 1000000007;
  cout << ans << endl;
  return 0;
}
