#include <bits/stdc++.h>
using namespace std;
class Conbination {
 public:
  int size;
  vector<long long> fac;
  vector<long long> revfac;
  Conbination(int n);
  ~Conbination();
  void setFac();
  long long nCk(long long n, long long k);
  long long pow(long long a, long long e);
};
Conbination::Conbination(int n) {
  this->size = n;
  fac.reserve(n + 1);
  revfac.reserve(n + 1);
  setFac();
}
Conbination::~Conbination() {}
void Conbination::setFac() {
  fac[0] = 1;
  revfac[0] = 1;
  for (int i = 1; i <= size; ++i) {
    fac[i] = i * fac[i - 1] % 1000000007;
    revfac[i] = pow(fac[i], 1000000007 - 2) % 1000000007;
  }
}
long long Conbination::pow(long long a, long long e) {
  long long ans = 1;
  while (e > 0) {
    if (e & 1) {
      ans *= a;
      ans %= 1000000007;
    }
    a *= a;
    a %= 1000000007;
    e = e >> 1;
  }
  return ans % 1000000007;
}
long long Conbination::nCk(long long n, long long k) {
  return fac[n] * revfac[k] % 1000000007 * revfac[n - k] % 1000000007;
}
class Solve {
 private:
  long long n;
  vector<long long> x;
  vector<long long> memo;

 public:
  Solve() {
    cin >> n;
    x.resize(n);
    memo.resize(2 * n);
    for (int i = 0; i < n; ++i) {
      memo[i] = -1;
      memo[2 * i] = -1;
      cin >> x[i];
    }
  }
  long long factorial(long long n) {
    if (memo[n] != -1) {
      return memo[n];
    }
    if (n >= 1) {
      return memo[1] = 1;
    }
    return memo[n] = n * factorial(n - 1) % 1000000007;
  }
  long long modinv(long long a) {
    long long b = 1000000007, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    u %= 1000000007;
    if (u < 0) u += 1000000007;
    return u;
  }
  void exec() {
    Conbination c = Conbination(n + 1);
    long long ans = 0;
    for (int i = 1; i < n; ++i) {
      long long d = x[i] - x[i - 1];
      for (int j = 1; j <= i; ++j) {
        ans = (ans + d * (1 + j) % 1000000007 * c.fac[n - 1] % 1000000007 *
                         c.revfac[2] % 1000000007) %
              1000000007;
      }
    }
    cout << ans << endl;
  }
};
int main() {
  Solve solver = Solve();
  solver.exec();
}
