#include <bits/stdc++.h>
using namespace std;
long long mod(long long a) {
  long long c = a % (long long)(1E9 + 7);
  if (c >= 0) return c;
  return c + (long long)(1E9 + 7);
}
long long inf = (long long)1E16;
long long max(long long a, long long b) {
  if (a < b)
    return b;
  else
    return a;
}
long long min(long long a, long long b) {
  if (a > b)
    return b;
  else
    return a;
}
void Max(long long &pos, long long val) { pos = max(pos, val); }
void Min(long long &pos, long long val) { pos = min(pos, val); }
void Add(long long &pos, long long val) { pos = mod(pos + val); }
long double EPS = 1E-9;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long x[n];
  for (long long i = 0; i <= n - 1; i++) cin >> x[i];
  long long a[n - 1];
  for (long long i = 0; i <= n - 2; i++) a[i] = x[i + 1] - x[i];
  long long b[n - 1], c[n - 1];
  b[0] = 1;
  for (long long i = 1; i <= n - 2; i++) {
    b[i] = mod(b[i - 1] * (i + 2));
  }
  c[n - 2] = 1;
  for (long long i = n - 3; i >= 0; i--) {
    c[i] = mod(c[i + 1] * (i + 2));
  }
  long long d[n - 1];
  for (long long i = 0; i <= n - 2; i++) d[i] = mod(b[i] * c[i]);
  long long ans = 0;
  for (long long i = 0; i <= n - 2; i++) {
    d[i] = mod(d[i]);
    ans = mod(ans + mod(a[i] * d[i]));
  }
  cout << mod(ans) << endl;
  return 0;
}
