#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& cout, vector<T> V) {
  cout << "[ ";
  for (auto v : V) cout << v << ' ';
  return cout << ']';
}
template <class L, class R>
ostream& operator<<(ostream& cout, pair<L, R> P) {
  return cout << '(' << P.first << ',' << P.second << ')';
}
long long int modpow(long long int a, long long int n) {
  long long int ans = 1;
  while (n) {
    if (n % 2) ans = (ans * a) % 1000000007;
    a = (a * a) % 1000000007;
    n /= 2;
  }
  return ans;
}
long long int inv(long long int a) { return modpow(a, 1000000007 - 2); }
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int fact[2001];
  fact[0] = 1;
  for (long long int i = 0; i < (2000); i++)
    fact[i + 1] = (fact[i] * (i + 1)) % 1000000007;
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for (long long int i = 0; i < (n); i++) cin >> a[i];
  vector<long long int> b(n - 1);
  for (long long int i = 0; i < (n - 1); i++) b[i] = a[i + 1] - a[i];
  long long int ans = 0;
  for (long long int i = 0; i < (n); i++) {
    for (long long int j = i; j < n - 1; j++) {
      long long int tans = (b[j] * inv(j - i + 1)) % 1000000007;
      ans = (ans + tans) % 1000000007;
    }
  }
  ans = (ans * fact[n - 1]) % 1000000007;
  cout << ans << '\n';
  cerr << "Time : " << 1000 * (long double)clock() / (long double)CLOCKS_PER_SEC
       << "ms\n";
  ;
}
