#include <bits/stdc++.h>
using namespace std;
void Debug() { cerr << '\n'; }
template <class FIRST, class... REST>
void Debug(FIRST arg, REST... rest) {
  cerr << arg << " ";
  Debug(rest...);
}
template <class T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  if (!v.empty()) {
    for (int i = int(0); i < int((int)(v).size() - 1); i++) out << v[i] << ", ";
    out << v.back();
  }
  out << "]";
  return out;
}
template <class S, class T>
ostream& operator<<(ostream& out, const pair<S, T>& v) {
  out << "(" << v.first << ", " << v.second << ")";
  return out;
}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const long long mod = 1000000007;
const int inf = (1 << 30) - 1;
const long long linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng;
long long fac[MAX_N], inv[MAX_N], fiv[MAX_N];
long long mod_pow(long long a, long long n) {
  if (n == 0) return 1;
  long long res = mod_pow(a, n / 2);
  if (n % 2 == 0)
    return res * res % mod;
  else
    return a * res % mod * res % mod;
}
long long invf(long long a) { return mod_pow(a, mod - 2); }
void C_init(int n) {
  fac[0] = fac[1] = 1;
  inv[1] = 1;
  fiv[0] = fiv[1] = 1;
  for (int i = int(2); i < int(n + 1); i++) {
    fac[i] = fac[i - 1] * i % mod;
    inv[i] = mod - inv[mod % i] * (mod / i) % mod;
    fiv[i] = fiv[i - 1] * inv[i] % mod;
  }
}
long long C(int a, int b) {
  if (a < b || a < 0 || b < 0) return 0;
  return fac[a] * fiv[b] % mod * fiv[a - b] % mod;
}
long long N;
long long A[MAX_N];
long long dp[2010][2010];
long long loop(vector<int> vec) {
  if ((int)(vec).size() == 1) return 0;
  long long res = 0;
  for (int i = int(0); i < int((int)(vec).size() - 1); i++) {
    vector<int> tmp;
    for (int j = int(0); j < int((int)(vec).size()); j++) {
      if (i == j) continue;
      tmp.push_back(vec[j]);
    }
    res = (res + long long(((vec[i + 1] - vec[i] + loop(tmp)) *
                            inv[(int)(vec).size() - 1]) %
                           mod)) %
          mod;
  }
  return res;
}
void solve() {
  cin >> N;
  C_init(N);
  dp[1][1] = 1;
  for (int i = int(2); i < int(N); i++) {
    for (int j = int(1); j < int(i + 1); j++) {
      dp[i][j] =
          (1 + ((i - j) * dp[i - 1][j] % mod + j * dp[i - 1][j - 1] % mod)) *
          inv[i] % mod;
    }
  }
  for (int i = int(0); i < int(N); i++) cin >> A[i];
  long long res = 0;
  for (int i = int(1); i < int(N); i++) {
    res = (res + long long((A[i] - A[i - 1]) * dp[N - 1][i] % mod)) % mod;
  }
  cout << res * fac[N - 1] % mod << "\n";
}
uint32_t rd() {
  uint32_t res;
  res = std::random_device()();
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed;
  cout.precision(20);
  cerr << fixed;
  cerr.precision(6);
  rng.seed(rd());
  solve();
  cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  return 0;
}
