#include <bits/stdc++.h>
using namespace std;
int main() {
  long N;
  cin >> N;
  vector<long> X(N), C(N - 1);
  for (int i = 0; i < N; i++) cin >> X[i];
  for (int i = 0; i < N - 1; i++) C[i] = X[i + 1] - X[i];
  long P = 1;
  for (int i = 1; i <= N - 1; i++) P = (P * i) % 1000000007;
  long ans = 0;
  for (int j = 0; j < N - 1; j++) {
    long tmp = 0;
    for (int i = 0; i <= j; i++) tmp = (tmp + P / (i + 1)) % 1000000007;
    ans = (ans + tmp * C[j] % 1000000007) % 1000000007;
    assert(ans > 0);
  }
  cout << ans % 1000000007;
}
