#include <bits/stdc++.h>
using namespace std;
long long fact(long long n, long long m) {
  long long ret = 1;
  for (long long i = m + 1; i <= n; ++i) ret *= i;
  return ret;
}
long long func(long long n) {
  long long ret = 0;
  long long val = fact(n, 0);
  for (long long i = 1; i <= n; ++i) ret += val / i;
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, mod = 1000000000 + 7, ans = 0;
  cin >> n;
  vector<long long> v(n, 0), d(n - 1, 0);
  for (long long(i) = 0; i < (n); ++(i)) cin >> v[i];
  for (long long i = 0; i < n - 1; ++i) d[i] = v[i + 1] - v[i];
  for (long long i = 1; i <= n - 1; ++i) {
    ans += (d[i - 1] * func(i) * fact(n - 1, i));
    ans %= mod;
  }
  cout << (ans) << endl;
  return 0;
}
