#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> x(n);
  for (long long i = 0; i < n; i++) cin >> x[i];
  n--;
  vector<long long> t(n);
  for (long long i = 0; i < n; i++) {
    t[i] = x[i + 1] - x[i];
  }
  vector<vector<long long>> ans3(n, vector<long long>(n, 0));
  ans3[0][0] = 1;
  for (long long k = 0; k < n - 1; k++) {
    for (long long j = 0; j < k + 1; j++) {
      for (long long i = 0; i < j + 1; i++) {
        ans3[i][j] *= k + 2;
      }
    }
    for (long long i = 0; i < k + 1; i++) {
      ans3[i][k + 1] += ans3[i][k] * ((double)(k + 1) / (k + 2));
      ans3[i + 1][k + 1] += ans3[i][k] * ((double)1 / (k + 2));
    }
  }
  vector<long long> mul(n, 0);
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      mul[j] += ans3[i][j] * (i + 1);
      mul[j] %= (1000000000 + 7);
    }
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += (mul[i] * t[i]) % (1000000000 + 7);
    ans %= (1000000000 + 7);
  }
  cout << ans << endl;
  return 0;
}
