#include <bits/stdc++.h>
using namespace std;
long long kaijo(long long x) {
  long long ans = 1;
  if (x == 1) {
    return ans;
  }
  ans = x * kaijo(x - 1);
  if (x >= 1000000007) x % 1000000007;
  return ans;
}
int main() {
  long long N;
  cin >> N;
  vector<long long> vec(N);
  for (int i = 0; i < N; ++i) {
    cin >> vec.at(i);
  }
  long long ans = 0, x = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i; j + 1 < N; ++j) {
      x += (vec.at(j + 1) - vec.at(j)) * kaijo(N - 1) * (j + 1) / (N - 1);
      if (x >= 1000000007) x % 1000000007;
    }
    ans += x;
    x = 0;
    if (ans >= 1000000007) ans % 1000000007;
  }
  cout << ans << endl;
}
