#include <bits/stdc++.h>
const char sp = ' ';
const long long mod = 1000000007;
using namespace std;
long long kaijoex(long long index, long long exception) {
  long long ans = 1;
  while (index > 1) {
    if (index == exception) {
      index--;
      continue;
    }
    ans *= index;
    ans = ans % mod;
    index--;
  }
  return ans;
}
int main(void) {
  long long N, x[100005], memo[100005];
  cin >> N;
  long long count = 0;
  for (int i = 0, i_len = (N); i < i_len; ++i) cin >> x[i];
  for (int i = 0, i_len = (N - 1); i < i_len; ++i)
    memo[i] = kaijoex(N - 1, i + 1);
  for (int i = 0, i_len = (N - 2); i < i_len; ++i)
    memo[i + 1] += memo[i], memo[i + 1] %= mod;
  for (int i = 0, i_len = (N - 1); i < i_len; ++i) {
    count += (x[i + 1] - x[i]) * memo[i];
    count %= mod;
  }
  cout << count << endl;
  return 0;
}
