#include <bits/stdc++.h>
using namespace std;
int N;
int K;
uint64_t mulVal() {
  uint64_t ret = 1;
  for (int i = 1; i < N; i++) {
    ret *= i;
  }
  return ret;
}
int main() {
  cin >> N;
  uint64_t x[N];
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }
  uint64_t sum = 0;
  for (int i = 1; i < N; i++) {
    uint64_t littleSum = (x[i] - x[i - 1]) * mulVal();
    uint64_t bunshi = 0;
    uint64_t bunbo = 1;
    for (int j = 1; j <= i; j++) {
      bunshi += j;
      bunbo *= j;
    }
    littleSum = littleSum * bunshi / bunbo;
    sum += littleSum;
  }
  cout << sum % uint64_t(1000000007) << endl;
  return 0;
}
