#include <bits/stdc++.h>
using namespace std;
int fact(int n) {
  if (n == 0)
    return 1;
  else
    return n * fact(n - 1) % 1000000007;
}
int fact_i(int n, int i) {
  if (n == 0) {
    return 1;
  } else if (n == i) {
    return fact_i(n - 1, i);
  } else {
    return n * fact_i(n - 1, i) % 1000000007;
  }
}
int main() {
  int n;
  cin >> n;
  vector<int> x(n), r(n - 1);
  for (int i = 0; i < n; i++) {
    cin >> x.at(i);
  }
  for (int i = 1; i < n; i++) {
    r.at(i - 1) = x.at(i) - x.at(i - 1);
  }
  int c = 1000000007;
  long long answer = 0;
  long long p = fact(n - 1);
  for (int i = 0; i < n - 1; i++) {
    answer = (answer + (p * r.at(i) % c)) % c;
    p = (p + fact_i(n - 1, i + 2)) % c;
  }
  cout << answer << endl;
}
