#include <bits/stdc++.h>
using namespace std;
const int SZ = 100005;
const long long MD = (long long)1e9 + 7;
long long arr[SZ];
long long inv[SZ];
long long pre[SZ];
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  inv[0] = inv[1] = 1;
  for (long long i = 2; i <= n; i++)
    inv[i] = (MD - (inv[MD % i] * (MD / i)) % MD) % MD;
  long long nfac = 1;
  for (long long i = 2; i < n; i++) nfac = (nfac * i) % MD;
  pre[0] = pre[1] = nfac;
  for (int i = 2; i <= n; i++) pre[i] = nfac * inv[i] % MD;
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= i; j++) {
      ans = (ans + (arr[i + 1] - arr[i]) * pre[i - j + 1]) % MD;
      0;
    }
  }
  cout << ans;
  return 0;
}
