#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  long long w = 1;
  cin >> n;
  long long x[100000];
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
    w *= (i + 1);
  }
  w /= n;
  long long ans = 0;
  ans += x[n - 1] - x[0];
  for (int end = 1; end < n; ++end) {
    for (int i = 0; i < end; ++i) {
      ans += x[end] - x[i];
    }
    ans += x[n - 1] - x[end];
  }
  cout << ((ans / (n - 1)) * w) % 1000000007;
}
