#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const LL MOD = 1000000007;
template <typename T>
using V = vector<T>;
using Vll = V<LL>;
LL factorial(int x, int m = 0) {
  LL a = 1;
  if (m == 0) {
    for (int(i) = (x); (i) >= (1); (i)--) {
      a *= i;
    }
  } else {
    for (int(i) = (x); (i) >= (1); (i)--) {
      a = (a * i) % m;
    }
  }
  return a;
}
int main() {
  int n;
  cin >> n;
  Vll x(n);
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> x[i];
  }
  double p = 1. / (n - 1.);
  LL n_1 = factorial(n - 1, MOD);
  LL n_2 = n_1 / (n - 1);
  Vll s(n - 1, 0);
  for (int(i) = 0; (i) < (n - 1); (i)++) {
    for (int(j) = (i + 1); (j) < (n); (j)++) {
      LL d = (x[j] - x[i]) % MOD;
      s[i] = (s[i] + d) % MOD;
    }
    s[i] = (s[i] * n_1 / (n - (i + 1))) % MOD;
  }
  LL total = 0;
  for (int(i) = 0; (i) < (n - 1); (i)++) {
    total = (total + s[i]) % MOD;
  }
  cout << (total * n_2) % MOD << endl;
  return 0;
}
