#include <bits/stdc++.h>
int64_t inf = 1000000007;
int64_t giant = 4000000000000000037;
using namespace std;
int64_t n;
vector<int64_t> pl;
int64_t o[100050];
int64_t dp[100050];
int64_t sa[100050];
void input() {
  cin >> n;
  pl.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> pl[i];
  }
}
int main() {
  input();
  o[2] = 1;
  dp[2] = pl[n - 1] - pl[n - 2];
  sa[2] = pl[n - 1] - pl[n - 2];
  for (int i = 3; i < n + 1; i++) {
    o[i] = o[i - 1] * (i - 1);
    o[i] %= inf;
    sa[i] = sa[i - 1] + (i - 1) * (pl[n - i + 1] - pl[n - i]);
    sa[i] %= inf;
    dp[i] = dp[i - 1] * (i - 1) + sa[i] * o[i - 1];
    dp[i] %= inf;
  }
  cout << dp[n] << endl;
  return 0;
}
