#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long modpow(long long a, long long b) {
  long long c = 1;
  while (b > 0) {
    if (b & 1) c = a * c % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return c;
}
long long kaijou(long long n) {
  if (n <= 1)
    return 1;
  else
    return (n * kaijou(n - 1) % mod) % mod;
}
int main() {
  int n;
  cin >> n;
  long long x[n];
  long long y[n];
  long long kai = 1;
  for (int i = 1; i < n; i++) kai = kai * i % mod;
  for (int i = 0; i < (n); i++) cin >> x[i];
  y[0] = 0;
  for (int i = 1; i < n; i++) {
    y[i] = kai * modpow(i, mod - 2) % mod;
    y[i] = (y[i - 1] + y[i]) % mod;
    cout << y[i] << endl;
  }
  long long sum = 0;
  for (int i = 0; i < (n - 1); i++) {
    sum += y[i + 1] * (x[i + 1] - x[i]);
    sum %= mod;
  }
  cout << sum << endl;
  return 0;
}
