#include <bits/stdc++.h>
using namespace std;
constexpr long long int linf = numeric_limits<long long int>::max() - 5;
constexpr int inf = numeric_limits<int>::max() - 5;
constexpr long long int mod = 1000000007;
int main() {
  vector<long long int> prod(100001);
  prod[0] = 1;
  for (long long int i = (1); (i) < (100001); (i)++) {
    prod[i] = (prod[i - 1] * i) % mod;
  }
  long long int result = 0;
  long long int n;
  cin >> n;
  vector<long long int> v(n);
  for (long long int i = 0; (i) < (n); i++) {
    scanf("%lld", &v[i]);
  }
  vector<long long int> dp(n + 1);
  dp[0] = prod[n - 1];
  for (long long int i = (1); (i) < (n); (i)++) {
    dp[i] = (dp[i - 1] + prod[n - i - 1]) % mod;
  }
  for (long long int i = 0; (i) < (n - 1); i++) {
    result += (dp[i] * (v[i + 1] - v[i])) % mod;
  }
  cout << result % mod << endl;
  return 0;
}
