#include <bits/stdc++.h>
using namespace std;
constexpr int INF_int = 1001001001;
constexpr long long MOD = 1000000007LL;
int N;
vector<long long> X;
long long int fact_mod(long long int num) {
  long long int ret = 1;
  for (int i = 1; i <= num; i++) ret = ret * i % MOD;
  return ret;
}
long long int sol() {
  long long int Facto = fact_mod((long long int)N - 1);
  vector<long long> D(N, 0);
  for (int i = 1; i < N; i++) D[i] = X[i] - X[i - 1];
  long long int ans = 0;
  for (int i = 1; i < N; i++) {
    long long int sum(0);
    for (int j = 1; j <= i; j++) sum = (sum + Facto / j) % MOD;
    ans = (ans + sum * D[i]) % MOD;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  cin >> N;
  X.resize(N);
  for (auto &x : X) cin >> x;
  cout << sol() << endl;
  return 0;
}
