#include <bits/stdc++.h>
using namespace std;
struct read_item {
  read_item(){};
  template <class T>
  operator T() {
    T t;
    std::cin >> t;
    return t;
  }
};
const long long inf = (long long)1.05e18;
const long long mod = 1e9 + 7;
int main() {
  const int n = read_item();
  vector<int> xs(n);
  for (int i = 0; i < n; i++) {
    xs[i] = read_item();
  }
  vector<long long> fact(n);
  fact[0] = 1;
  fact[1] = 1;
  for (int i = 2; i <= n; i++) {
    fact[i] = fact[i - 1] * i % mod;
  }
  vector<long long> dp;
  dp.resize(n);
  dp[n - 1] = 0;
  for (int pos = n - 2; pos >= 0; pos--) {
    long long a = 0;
    for (int j = pos + 1; j < n; j++) {
      a += fact[n - j] * (xs[j] - xs[pos]) % mod;
      a = a % mod;
    }
    dp[pos] = (dp[pos + 1] + a) % mod;
  }
  printf("%lld\n", dp[0]);
  return 0;
}
