#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N;
  vector<long long int> x;
  cin >> N;
  long long int N_ex = 1;
  for (int i = 0; i < N; i++) {
    long long int tmp;
    cin >> tmp;
    x.push_back(tmp);
  }
  for (int i = 1; i <= N - 1; i++) {
    N_ex = (N_ex * i) % 1000000007;
  }
  long long int ans = 0;
  for (long long int i = 1; i <= N - 1; i++) {
    ans = ((ans + (N_ex / (i) * (x[N - 1] - x[i - 1]))) % 1000000007);
  }
  cout << ans;
  return 0;
}
