#include <bits/stdc++.h>
using namespace std;
long long fact(long long n, long long skip) {
  if (n <= 1)
    return 1;
  else if (n == skip)
    return fact(n - 1, skip);
  else
    return ((n % 1000000007) * fact(n - 1, skip)) % 1000000007;
}
int main(void) {
  long long n;
  cin >> n;
  long long x[100000];
  for (int i = 0; (i) < (n); i++) cin >> x[i];
  long long p[100000];
  p[0] = fact(n - 1, 0);
  for (int i = 0; (i) < (n - 2); i++) {
    p[i + 1] = (p[i] + fact(n - 1, i + 2)) % 1000000007;
  }
  long long ans = 0;
  for (int i = 0; (i) < (n - 1); i++) {
    ans = (ans + ((x[i + 1] - x[i]) * p[i]) % 1000000007) % 1000000007;
  }
  cout << ans << endl;
}
