#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long abc(long long x, long long y) {
  long long now = 1;
  for (long long i = x; i > 0; i--) {
    if (i != y) {
      now = now * i;
      now = now % MOD;
    }
  }
  return now;
}
int main() {
  long long n;
  cin >> n;
  vector<long long> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  long long total = vec[n - 1] - vec[0];
  vector<long long> vec2(n);
  vec2[0] = total;
  for (long long i = 1; i < n; i++) {
    total = total - (vec[i] - vec[i - 1]);
    vec2[i] = total;
  }
  long long ans = 0;
  for (long long i = 0; i < n - 1; i++) {
    long long aaa = abc(n - 1, i + 1);
    ans += vec2[i] * aaa;
    ans = ans % MOD;
  }
  cout << ans << endl;
  return 0;
}
