#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  long long ans = 0;
  long long k = 1;
  cin >> N;
  vector<long long> kai(N + 1);
  for (long long i = 0; i < N; i++) {
    kai[i + 1] = k;
    k *= (i + 2);
    kai[i + 1] %= 1000000007;
  }
  k = 1;
  vector<long long> X(N), Y(N - 1);
  for (long long i = 0; i < N; i++) cin >> X[i];
  for (long long i = 0; i < N - 1; i++) {
    Y[i] = X[i + 1] - X[i];
    ans += Y[i] * k * kai[N - i - 1];
    k += (i + 2);
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
