#include <bits/stdc++.h>
long long p = 1000000007;
long long n, ans;
long long x[100000];
long long y[2005][2005];
int main() {
  scanf("%lld", &n);
  for (long long i = 0; i < n; i++) {
    scanf("%lld", x + i);
  }
  if (n > 2000) return 0;
  y[0][0] = 1;
  for (long long i = 1; i < n; i++) {
    y[i][0] = (i * y[i - 1][0]) % p;
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 1; j <= i; j++) {
      y[i][j] = ((y[i - 1][j - 1] + y[i][j - 1]) % p);
    }
  }
  for (long long i = 0; i < n - 1; i++) {
    ans += (((x[n - 1] - x[n - 2 - i]) * y[n - 2][i]) % p);
    ans = ans % p;
  }
  printf("%lld\n", ans % p);
}
