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