#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> X(N), C(N - 1);
  for (int i = 0; i < N; i++) cin >> X[i];
  for (int i = 0; i < N - 1; i++) C[i] = X[i + 1] - X[i];
  long long P = 1;
  for (int i = 1; i <= N - 1; i++) P = (P * i) % 1000000007;
  long long ans = 0;
  vector<long long> T(N);
  T[0] = P;
  for (int i = 1; i < N - 1; i++)
    T[i] = (T[i - 1] + (P / (i + 1))) % 1000000007;
  for (int j = 0; j < N - 1; j++) {
    long long tmp = T[j] % 1000000007;
    ans = (ans + (tmp * C[j])) % 1000000007;
    assert(P >= 0);
    assert(tmp >= 0);
    assert(ans >= 0);
  }
  cout << ans % 1000000007;
}
