// Written by newbiechd
#include <cstdio>

const int maxN = 100003, mod = 1e9 + 7;
int x[maxN], inv[maxN];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    scanf("%d", &x[i]);
  inv[1] = 1;
  for (int i = 2; i <= n; ++i)
    inv[i] = -1ll * (mod / i) * inv[mod % i] % mod;
  int ans = 0, temp = 0;
  for (int i = 1; i < n; ++i) {
    temp = (temp + inv[i]) % mod;
    ans = (1ll * temp * (x[i + 1] - x[i]) + ans) % mod;
  }
  for (int i = 1; i < n; ++i)
    ans = 1ll * ans * i % mod;
  printf("%d\n", (ans + mod) % mod);
  return 0;
}
