#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int LARGE_INT = 1e9 + 100;
const int INF = 2e9 + 100;
const long long INF_LL = (long long)INF * 300 * 300;
const int MOD = 1e9 + 7;
long long my_pow(long long x, long long y) {
  long long a = 1;
  for (int i = (0); i < (y); ++i) {
    a *= x;
    a %= MOD;
  }
  return a % MOD;
}
long long my_kai(long long x) {
  long long a = 1;
  for (int i = (1); i < (x + 1); ++i) {
    a *= i;
    a %= MOD;
  }
  return a % MOD;
}
void Main() {
  int n;
  cin >> n;
  vector<long long> x(n);
  for (int i = (0); i < (n); ++i) cin >> x[i];
  vector<long long> dist(n - 1);
  for (int i = (0); i < (n - 1); ++i) {
    dist[i] = x[i + 1] - x[i];
  }
  long long kai = my_kai(n - 1);
  kai %= MOD;
  vector<long long> kai2(n - 1);
  kai2[0] = kai;
  for (int i = (1); i < (n - 1); ++i) {
    kai2[i] = (kai2[i - 1] + kai / (i + 1)) % MOD;
  }
  long long result = 0;
  for (int i = (0); i < (n - 1); ++i) {
    result += (dist[i] * kai2[i]) % MOD;
    result %= MOD;
  }
  cout << result << endl;
  return;
}
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}
