#include <bits/stdc++.h>
using namespace std;
long long n, a[100003], s = 1, jie[100003], ans, sum[100003];
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]);
  for (long long i = 1; i <= n; ++i) sum[i] = sum[i - 1] + 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 - 2; ++i)
    ans = (ans + aa(i - 1, i - 1) * aa(n - 1, n - 1 - (i + 1)) % mod *
                     (sum[n - 1] - sum[n - 1 - i] - sum[i]) % mod) %
          mod;
  for (long long i = 1; i < n; ++i)
    ans = (ans + aa(n - i - 1, n - i - 1) * aa(n - 1, n - (n - i + 1)) % mod *
                     (a[n] - a[i]) % mod) %
          mod;
  cout << ans;
  return 0;
}
