#include <bits/stdc++.h>
using namespace std;
long long n, a[100003], s = 1, jie[100003], ans;
const long long mod = 1e9 + 7;
long long poww(long long x, long long p) {
  if (p == 0) return 1;
  long long tmp = poww(x, p / 2) % mod;
  tmp = (tmp * tmp) % mod;
  if (p % 2 == 1) tmp = (tmp * x) % mod;
  return tmp;
}
long long aa(long long n, long long m) {
  return jie[n] * poww(jie[n - m], mod - 2) % mod;
}
signed main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]);
  jie[1] = 1, jie[0] = 1;
  for (long long i = 2; i <= 100000; i++) jie[i] = jie[i - 1] * i % mod;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= i - 1; j++) {
      if (i == n)
        ans = (ans + (a[i] - a[j]) % mod * aa(i - j - 1, i - j - 1) % mod *
                         aa(n - 1, n - (i - j + 1))) %
              mod;
      else
        ans = (ans + (a[i] - a[j]) % mod * aa(i - j - 1, i - j - 1) % mod *
                         aa(n - 1, n - 1 - (i - j + 1))) %
              mod;
    }
  }
  cout << ans;
  return 0;
}
