#include <bits/stdc++.h>
using namespace std;
int beki(int a, int b) {
  int x = 1;
  while (b != 0) {
    if (b & 1) {
      x = ((((long long)x * a + 1000000007)) % 1000000007);
    }
    a = ((((long long)a * a + 1000000007)) % 1000000007);
    b >>= 1;
  }
  return x;
}
int gyakugen(int a) { return beki(a, 1000000007 - 2); }
int main() {
  int N;
  cin >> N;
  vector<int> x(N);
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }
  vector<int> a(N + 1, 0);
  int k = 1;
  for (int i = 1; i <= N; i++) {
    a[i] =
        ((((long long)((((long long)i * a[i - 1] + 1000000007)) % 1000000007) +
           k + 1000000007)) %
         1000000007);
    k = ((((long long)k * i + 1000000007)) % 1000000007);
  }
  int ans = 0;
  int S = 0;
  k = 1;
  for (int i = 1; i <= N - 1; i++) {
    k = ((((long long)k * i + 1000000007)) % 1000000007);
  }
  for (int i = 0; i < N - 1; i++) {
    int sum = (a[i + 1] * k);
    k = ((((long long)k * gyakugen(i + 2) + 1000000007)) % 1000000007);
    sum = ((((long long)sum * (x[i + 1] - x[i]) + 1000000007)) % 1000000007);
    ans = ((((long long)ans + sum + 1000000007)) % 1000000007);
  }
  cout << ans << endl;
  return 0;
}
