#include <bits/stdc++.h>
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
using namespace std;
void io() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
long long n, m, k, t, cnt, ans;
long long a[200010], pre[200010] = {1, 1};
const long long mod = 1e9 + 7;
long long qpow(long long a, long long b, long long mod) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
int main() {
  io();
  cin >> n;
  for (long long i = 1; i <= n; ++i) pre[i] = pre[i - 1] * i % mod;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  for (long long i = 1; i <= (n - 1); ++i) {
    for (long long j = (i + 1); j <= n; ++j) {
      if (j == n)
        ans = (ans +
               (a[j] - a[i]) * pre[n - 1] % mod * qpow(j - i, mod - 2ll, mod) %
                   mod +
               mod) %
              mod;
      else
        ans = (ans +
               (a[j] - a[i]) * pre[n - 1] % mod *
                   qpow((j - i) * (j - i + 1ll), mod - 2ll, mod) % mod +
               mod) %
              mod;
    }
  }
  cout << ans;
}
