#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7, MAx = 1e18, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W,
    x, y, z;
long long max_value = INF, max_index = -1;
long long min_value = MAx, min_index = -1;
long long calc(int a, int b, int p) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    long long d = calc(a, b / 2, p);
    return (d * d) % p;
  } else {
    return (a * calc(a, b - 1, p)) % p;
  }
}
int main() {
  cin >> N;
  long long delta[100000];
  long long func[100000];
  long long sum = 0;
  cin >> P;
  for (int i = 0; i < (int)(N - 1); i++) {
    cin >> C;
    delta[i + 1] = C - P;
    P = C;
  }
  func[1] = 1;
  for (long long i = 2; i <= N; i++) {
    func[i] = ((func[i - 1] % MOD) * i) % MOD;
  }
  for (long long i = 1; i < N; i++) {
    long long a = (((((delta[i] * (i + 1)) % MOD) * func[N - 1] % MOD) % MOD) *
                   calc(2, MOD - 2, MOD) % MOD) %
                  MOD;
    sum = (sum + a) % MOD;
  }
  cout << sum;
}
