#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 << ')';
}
inline long long ex(long long a, long long b) {
  if (b == 0 || a == 1) {
    return 1;
  }
  if (a == 0 || b == 1) {
    return a;
  }
  long long tmp = ex(a, (b / 2));
  if (b % 2) {
    return ((((tmp * tmp) % 1000000007) * a) % 1000000007);
  } else {
    return ((tmp * tmp) % 1000000007);
  }
}
inline long long inv(long long k) {
  if (k == 1) {
    return 1;
  } else {
    return ex(k, 1000000007 - 2);
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long NN = 1e5 + 5;
  vector<long long> fact(NN);
  fact[0] = 1;
  for (long long i = 1; i < NN; ++i) {
    fact[i] = (i * fact[i - 1]) % 1000000007;
  }
  long long n;
  cin >> n;
  vector<long long> inp(n + 1);
  for (long long i = 1; i <= n; ++i) {
    cin >> inp[i];
  }
  long long ans = 0;
  for (long long i = 1; i < n; ++i) {
    long long tmp =
        (((fact[n - 1] * (inp[n] - inp[i])) % 1000000007) * inv(n - i)) %
        1000000007;
    for (long long j = i + 1; j < n; ++j) {
      tmp += ((((((inp[j] - inp[i]) * fact[n - 1]) % 1000000007) *
                inv(j - i + 1)) %
               1000000007) *
              inv(j - i)) %
             1000000007;
      tmp %= 1000000007;
    }
    ans += tmp;
    ans %= 1000000007;
  }
  cout << ans << "\n";
}
