#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
long long quick_pow(int x, int times_) {
  if (times_ == 0) return 1;
  long long tmp = quick_pow(x, times_ >> 1);
  tmp *= tmp, tmp %= MOD;
  if (times_ & 1) tmp *= x;
  return tmp % MOD;
}
long long get_inv(int x) { return quick_pow(x, MOD - 2); }
long long get_div(int x, int y) { return x * get_inv(y) % MOD; }
int n, x[100000 + 10];
long long res;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> x[i];
  for (int i = 2; i <= n; ++i) {
    long long tmp = 0;
    for (int j = 1; j <= i - 1; ++j) {
      tmp += get_div(1, j);
      tmp %= MOD;
    }
    tmp *= x[i] - x[i - 1];
    tmp %= MOD;
    res += tmp;
    res %= MOD;
  }
  for (int i = 1; i <= n - 1; ++i) {
    res *= i;
    res %= MOD;
  }
  cout << res;
  return 0;
}
