#include <bits/stdc++.h>
using namespace std;
long long mypow(long long a, long long b, long long c) {
  if (b == 0) return 1;
  if (b % 2) return mypow(a, b - 1, c) * a % c;
  long long z = mypow(a, b / 2, c);
  return z * z % c;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long x[100000], y[100000], z[100000];
signed main() {
  long long n, ans = 0;
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> x[i];
  z[0] = 1;
  for (long long i = 0; i < n - 1; i++) {
    z[i + 1] = z[i] * (i + 1) % 1000000007;
    y[i + 1] = (y[i] * (i + 1) + z[i]) % 1000000007;
  }
  for (long long i = 0; i < n - 1; i++) {
    ans += (x[i + 1] - x[i]) * (z[n - 1] / z[i + 1]) % 1000000007 * y[i + 1] %
           1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
