#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }
int mul(int a, int b) { return int(1LL * a * b % mod); }
int fexp(int b, int e = mod - 2) {
  int ans = 1;
  while (e) {
    if (e & 1) ans = mul(ans, b);
    b = mul(b, b);
    e /= 2;
  }
  return ans;
}
const int N = 100005;
int n, x[N];
int fat[N], ifat[N];
int C(int i, int j) {
  if (j > i) return 0;
  return mul(mul(fat[i], ifat[j]), ifat[i - j]);
}
int id[N];
int mark[N];
int used[N];
int brute() {
  for (int i = 0; i < n; i++) id[i] = i;
  int ans = 0;
  do {
    for (int i = 0; i < n; i++) mark[i] = 1;
    for (int i = 0; i < n - 1; i++) {
      int j = id[i];
      mark[j] = 0;
      while (mark[j] == 0) {
        ans += x[j + 1] - x[j];
        used[j]++;
        if (j == 1 and id[i] == 0) {
          ;
          for (int k = 0; k < n - 1; k++) {
            ;
          };
        }
        if (ans >= mod) ans -= mod;
        j++;
      }
    }
  } while (next_permutation(id, id + n - 1));
  return ans;
}
int main() {
  fat[0] = ifat[0] = 1;
  for (int i = 1; i < N; i++) {
    fat[i] = mul(i, fat[i - 1]);
    ifat[i] = fexp(fat[i]);
  }
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", x + i);
  int ans = 0;
  for (int i = 0; i + 1 < n; i++) {
    int tmp = fat[n - 1];
    for (int j = 0; j < i; j++) {
      tmp = add(tmp, mul(mul(C(n - 1, i - j + 1), fat[i - j]),
                         fat[n - 1 - (i - j + 1)]));
    }
    ans = add(ans, mul(x[i + 1] - x[i], tmp));
    ;
  }
  printf("%d\n", ans);
  ;
  for (int i = 0; i + 1 < n; i++) {
    ;
  }
}
