#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 58;
const long long MOD = 1000000007;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
signed main() {
  long long N;
  cin >> N;
  vector<long long> v(N);
  for (long long i = 0; i < N; i++) cin >> v.at(i);
  long long num = 1;
  for (long long i = 1; i < N; i++) {
    num *= i;
    num %= MOD;
  }
  long long ans = 0;
  long long tmp = 0;
  for (long long i = 0; i < N - 1; i++) {
    tmp += num * modinv(i + 1, MOD) % MOD;
    ans += tmp * (v.at(i + 1) - v.at(i)) % MOD;
  }
  cout << ans << endl;
  return 0;
}
