#include <bits/stdc++.h>
using namespace std;
long long mypower(long long x, long long n) {
  if (n == 0) {
    return 1;
  }
  long long temp = mypower(x, n / 2);
  if (n % 2 == 1) {
    return (((temp * temp) % 1000000007) * x) % 1000000007;
  } else {
    return (temp * temp) % 1000000007;
  }
}
int main() {
  long long kaijo[100001];
  kaijo[0] = 1;
  for (long long i = 1; i <= 100000; i++) {
    kaijo[i] = kaijo[i - 1] * i;
    kaijo[i] %= 1000000007;
  }
  long long gyaku[100001];
  for (long long i = 0; i <= 100000; i++) {
    gyaku[i] = mypower(i, 1000000007 - 2);
  }
  int N;
  cin >> N;
  long long x[100000];
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }
  long long ans = 0;
  for (long long i = 0; i < N - 1; i++) {
    long long cnt = kaijo[N - 1];
    long long temp;
    for (long long k = i + 1; k < N; k++) {
      if (k == N - 1) {
        temp = cnt;
        ans += (temp * (x[N - 1] - x[i]));
        ans %= 1000000007;
      } else {
        temp = kaijo[N - 1];
        temp *= gyaku[k - i + 1];
        temp %= 1000000007;
        temp *= gyaku[k - i];
        temp %= 1000000007;
        cnt += 1000000007 - temp;
        cnt %= 1000000007;
        ans += temp * (x[k] - x[i]);
        ans %= 1000000007;
      }
    }
  }
  cout << ans << endl;
}
