#include <bits/stdc++.h>
using namespace std;
long long int bigmod = 1000000007;
long long int fex(long long int a, long long int b) {
  long long int ret;
  if (b == 0) return 1;
  ret = fex(a, b / 2);
  ret = (ret * ret) % bigmod;
  if (b & 1) ret = (ret * a) % bigmod;
  return ret;
}
int main() {
  long long int n, x[100005], f, dist, temp, ans = 0, mul = 0;
  scanf("%lld", &n);
  f = 1;
  for (long long int i = 2; i < n; i++) f *= i;
  for (long long int i = 0; i < n; i++) scanf("%lld", &x[i]);
  for (long long int i = 1; i < n; i++) {
    dist = x[i] - x[i - 1];
    temp = (f * fex(i, bigmod - 2)) % bigmod;
    mul = (mul + temp) % bigmod;
    temp = (mul * dist) % bigmod;
    ans = (ans + temp) % bigmod;
  }
  printf("%lld\n", ans);
  return 0;
}
