#include <bits/stdc++.h>
int main() {
  int N;
  scanf("%d", &N);
  std::vector<long long> x(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &x[i]);
  }
  std::vector<long long> sum(N + 1);
  long long mod = 1;
  for (int i = 2; i < N; i++) {
    mod *= i;
    mod %= 1000000007;
  }
  sum[1] = mod;
  for (int i = 2; i < N; i++) {
    sum[i] = (sum[i - 1] + mod / i) % 1000000007;
  }
  double val;
  long long ans = 0;
  for (int i = 1; i < N; i++) {
    ans += ((x[i] - x[i - 1]) * sum[i]) % 1000000007;
    ans %= 1000000007;
  }
  printf("%lld\n", ans);
  return 0;
}
