#include <bits/stdc++.h>
using namespace std;
constexpr long long mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  vector<long long> cum(n, 0);
  for (int i = 0; i < n - 1; i++)
    (cum[i + 1] = cum[i] + a[i + 1] - a[i]) %= mod;
  vector<long long> fact(n, 1);
  for (int i = 1; i < n; i++) {
    (fact[i] = fact[i - 1] * i) %= mod;
  }
  long long res = 0;
  for (int i = 0; i < n; i++) {
    (res += (cum[n - 1] - cum[i]) * fact[n - i - 1] % mod) %= mod;
  }
  cout << res << endl;
  return 0;
}
