#include <bits/stdc++.h>
using namespace std;
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
const long long INF = numeric_limits<long long>::max();
long long factorial(long long n) {
  if (n == 0)
    return 1;
  else {
    return (n % 1000000007 * factorial(n - 1) % 1000000007) % 1000000007;
  }
}
long long without_factorial(long long n, int k) {
  long long res = 1;
  for (int i = 1; i < (n + 1); i++) {
    if (i != k) res = (res * i) % 1000000007;
  }
  return res;
}
int main() {
  int N;
  cin >> N;
  vector<long long> x(N), num(N - 1);
  for (int i = 0; i < (N); i++) {
    cin >> x[i];
  }
  num[0] = factorial(N - 1);
  long long sum = 0;
  for (int i = 1; i < (N - 1); i++) {
    num[i] = (num[i - 1] + without_factorial(N - 1, i + 1)) % 1000000007;
    sum = (sum + ((x[i] - x[i - 1]) % 1000000007) * (num[i - 1] % 1000000007)) %
          1000000007;
  }
  sum = (sum + (x[N - 1] - x[N - 2]) % 1000000007 * (num[N - 2] % 1000000007)) %
        1000000007;
  cout << sum;
  return 0;
}
