#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 10110;
const int M = 1e9 + 7;
int n;
long long ksm(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % M;
    a = (a * a) % M;
    b /= 2;
  }
  return res % M;
}
long long inv[maxn];
void getinv() {
  inv[1] = 1;
  for (int i = 2; i < maxn; i++) inv[i] = (M - M / i) * inv[M % i] % M;
}
long long a[maxn];
int main() {
  getinv();
  cin >> n;
  long long res = 1;
  for (int i = 1; i < n; i++) {
    res = (res * i) % M;
  }
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    long long p = res;
    for (int j = 2; j <= i; j++) {
      p = (p + res * inv[j]) % M;
    }
    ans = (ans + (a[i + 1] - a[i]) * p) % M;
  }
  cout << ans << endl;
  return 0;
}
