#include <bits/stdc++.h>
using namespace std;
const int64_t mod = 1000000007;
int64_t power(int64_t n, int64_t k) {
  if (k == 0) return 1;
  int64_t half = power(n, k / 2), ans = half * half % mod;
  if (k % 2) {
    ans *= n;
    ans %= mod;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; i++) cin >> x.at(i);
  vector<int64_t> fact, inv;
  fact.push_back(1);
  inv.push_back(1);
  for (int i = 1; i <= n; i++) {
    fact.push_back(fact.at(i - 1) * i % mod);
    inv.push_back(power(fact.at(i), mod - 2));
  }
  int64_t ans = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      int64_t m = fact.at(n - 1) * power(j - i, mod - 2) % mod;
      ans += (x.at(j) - x.at(j - 1)) * m % mod;
      ans %= mod;
    }
  }
  cout << ans << endl;
}
