#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, mod = 1e9 + 7;
int n, a[N];
long long f[N];
long long inv(long long x) {
  return x == 1 ? x : (mod - mod / x) * inv(mod % x) % mod;
}
int main() {
  f[0] = 1;
  for (int i = 1; i < N; i++) f[i] = f[i - 1] * i % mod;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  long long ans = 0;
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j <= n; j++)
      if (j == n)
        ans = (ans + (a[j] - a[i]) * f[n - 1] % mod * inv(j - i) % mod) % mod;
      else
        ans = (ans + (a[j] - a[i]) * f[n - 1] % mod * inv(j - i) % mod *
                         inv(j - i + 1) % mod) %
              mod;
  printf("%lld\n", ans);
}
