#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
int main(void) {
  int N;
  cin >> N;
  long long x[N];
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }
  long long A[N - 1];
  for (int i = 0; i < N - 1; i++) {
    A[i] = x[i + 1] - x[i];
  }
  long long kaijou = 1;
  for (int i = 1; i < N; i++) {
    kaijou *= i;
    kaijou = kaijou % 1000000007;
  }
  long long ans = 0;
  for (int i = 0; i < N - 1; i++) {
    long long temp = kaijou;
    temp = temp * A[i] % 1000000007 * (i + 2) % 1000000007;
    ans += temp;
    ans = ans % 1000000007;
  }
  cout << ans * modinv(2, 1000000007) % 1000000007 << endl;
}
