#include <bits/stdc++.h>
using namespace std;
long long n;
long long powmod(long long a, long long b) {
  a %= 1000000007;
  long long res = 1;
  while (b > 0) {
    if (b % 2 == 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
    b /= 2;
  }
  return res;
}
long long f[210000];
void cominit() {
  f[0] = 1;
  for (long long i = 0; i < 200000; i++) f[i + 1] = f[i] * (i + 1) % 1000000007;
}
long long com(long long n, long long r) {
  if (n < r) return 0;
  if (n < 0 or r < 0) return 0;
  return f[n] * powmod(f[r] * f[n - r], 1000000007 - 2) % 1000000007;
}
long long perm(long long n, long long r) {
  if (n < r) return 0;
  if (n < 0 or r < 0) return 0;
  return f[n] * powmod(f[n - r], 1000000007 - 2) % 1000000007;
}
int main() {
  cominit();
  cin >> n;
  vector<long long> s(n), t(n + 100);
  for (long long i = 0; i < n; i++) cin >> s[i];
  t[0] = f[n - 1];
  for (long long i = 1; i <= n; i++) {
    t[i] = t[i - 1] + ((t[0] + i) / (i + 1));
    t[i] %= 1000000007;
  }
  long long ans = 0;
  for (long long i = 0; i < n - 1; i++) {
    ans += (s[i + 1] - s[i]) * t[i];
    ans %= 1000000007;
  }
  cout << ans << endl;
}
