#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const* argv[]) {
  int n;
  cin >> n;
  vector<long long> x(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  long long fac = 1;
  for (long long i = 0; i < n - 1; i++) {
    fac *= i + 1;
  }
  vector<long long> fact_lis(n - 1, fac);
  for (long long i = 0; i < n - 1; i++) {
    fact_lis[i] /= i + 1;
  }
  long long fact_sum = 0;
  long long expect_sum = 0;
  for (int i = 0; i < n - 1; i++) {
    fact_sum += fact_lis[i];
    expect_sum += (x[i + 1] - x[i]) * fact_sum;
  }
  long long mod = pow(10, 9) + 7;
  cout << expect_sum % mod << endl;
  return 0;
}
