#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e+9 + 7;
int main() {
  long long n;
  cin >> n;
  vector<long long> x(n);
  for (int i = 0; i < n; i++) cin >> x.at(i);
  vector<long long> fact(n + 1);
  fact[0] = 1;
  for (int i = 0; i < n; i++) fact.at(i + 1) = (fact.at(i) * (i + 1)) % MOD;
  long long ans = 0;
  long long sum = 0;
  for (int i = 0; i < n - 1; i++) {
    long long coeff = (fact[n - 1] / (i + 1)) % MOD;
    ans -= coeff * x.at(i);
    sum += coeff;
  }
  ans += sum * x.at(n - 1);
  cout << ans % MOD << endl;
}
