#include <bits/stdc++.h>

using namespace std;

const int MOD = 1000000007;

int add(int x, int y) { return ((x += y) >= MOD) ? x - MOD : x; }
int mul(int x, int y) { return (long long) x * y % MOD; }
int pw(int x, int y) {
   int ans = 1;
   for (; y > 0; y >>= 1, x = mul(x, x)) {
      if (y & 1) ans = mul(ans, x);
   }
   return ans;
}

int main() {
   ios_base::sync_with_stdio(false);
   int N;
   cin >> N;
   vector<int> X(N);
   for (int i = 0; i < N; ++i) {
      cin >> X[i];
   }
   int coeff = 0;
   int ans = 0;
   int fact = 1;
   for (int i = 0; i + 1 < N; ++i) {
      coeff = add(coeff, pw(i + 1, MOD - 2));
      fact = mul(fact, i + 1);
      ans = add(ans, mul(coeff, X[i + 1] - X[i]));
   }
   cout << mul(ans, fact) << "\n";
   return 0;
}
