#include <bits/stdc++.h>
int main() {
  long long int n;
  long long int x[100010];
  long long int l[100010];
  long long int all;
  long long int ans = 0;
  l[0] = 0;
  scanf("%lld", &n);
  scanf("%lld", &x[0]);
  for (long long int i = 1; i < n; i++) {
    scanf("%lld", &x[i]);
    l[i] = x[i] - x[i - 1];
  }
  all = x[n - 1] - x[0];
  for (long long int i = 2; i < n; i++) {
    ans = (ans + (l[i] * (i - 1)) % 1000000007) % 1000000007;
  }
  ans = (ans + (all * (n - 1)) % 1000000007) % 1000000007;
  for (long long int i = 1; i < n - 1; i++) {
    ans = (ans * i) % 1000000007;
  }
  printf("%lld", ans);
  return 0;
}
