#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
long long x[100005];
long long pow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b /= 2;
  }
  return res;
}
long long inv(long long u) { return pow(u, mod - 2); }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &x[i]);
  long long ans = 0;
  long long count = 0;
  long long hold = 1;
  for (int i = 2; i <= n - 1; i++) hold = hold * i % mod;
  for (int i = 1; i <= n - 1; i++) {
    count = (count + inv(i)) % mod;
    ans = ans + count * (x[i + 1] - x[i]) % mod;
  }
  printf("%lld\n", ans * hold % mod);
  return 0;
}
