#include <bits/stdc++.h>
using namespace std;
int n;
int MAX_N = 100000;
long long x[100000];
int p = 1000000000 + 7;
void solve();
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
  }
  solve();
  return 0;
}
void solve() {
  double ans = 0;
  double tmp = 0;
  for (int i = 0; i < n - 1; i++) {
    tmp += 1.0 / (i + 1);
    ans += tmp * (x[i + 1] - x[i]);
  }
  for (int i = 1; i <= n - 1; i++) {
    ans *= i;
  }
  long long ans2 = round(ans);
  ans2 = ans2 % p;
  printf("%d\n", ans2);
}
