#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  if (n > 2000) {
    cout << "muri" << endl;
    return 0;
  }
  vector<long long> vec;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long num;
    cin >> num;
    vec.push_back(num);
  }
  long long matrixOfDis[2005][2005];
  for (long long i = 0; i < 2005; i++) {
    for (long long j = 0; j < 2005; j++) {
      matrixOfDis[i][j] = 0;
    }
  }
  for (long long i = 0; i < n - 1; i++) {
    for (long long j = n - 1; j > i; j--) {
      matrixOfDis[i][j] = vec[j] - vec[i];
    }
  }
  long long nn = (n - 1);
  long long kaijo = nn;
  while (nn > 1) {
    kaijo = (kaijo * (nn - 1)) % 1000000007;
    nn--;
  }
  long long matrixOfMagic[2005][2005];
  for (long long i = 0; i < 2005; i++) {
    for (long long j = 0; j < 2005; j++) {
      matrixOfMagic[i][j] = 0;
    }
  }
  matrixOfMagic[n - 2][n - 1] = kaijo;
  for (long long i = n - 3; i >= 0; i--) {
    for (long long j = n - 1; j > i; j--) {
      if (j == n - 1) {
        long long res = (double)matrixOfMagic[i + 1][j] *
                        ((double)(n - i - 2) / (double)(n - i - 1));
        matrixOfMagic[i][j] = res % 1000000007;
      } else if (j == n - 2) {
        long long res = (double)matrixOfMagic[i + 1][j + 1] *
                        ((double)(1) / (double)(n - i - 1));
        matrixOfMagic[i][j] = res % 1000000007;
      } else {
        matrixOfMagic[i][j] = matrixOfMagic[i + 1][j + 1];
      }
    }
  }
  long long sum = 0;
  for (long long i = 0; i < 2002; i++) {
    for (long long j = 0; j < 2002; j++) {
      sum = (sum + (matrixOfMagic[i][j] * matrixOfDis[i][j]) % 1000000007) %
            1000000007;
    }
  }
  cout << sum << endl;
  return 0;
}
