#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ans = 0;
  long long MOD = 1000000009;
  int n;
  cin >> n;
  long long fact[100010];
  long long dp[100010];
  dp[0] = 1;
  fact[0] = 1;
  for (long long i = 1; i < 100010; i++) {
    fact[i] = fact[i - 1] * i;
    fact[i] %= MOD;
  }
  long long p[100010];
  long long d[100010];
  long long x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    p[i] = x;
    if (i != 0) {
      d[i] = p[i] - p[i - 1];
    }
  }
  cout << endl;
  for (int i = 3; i <= n; i++) {
    for (int j = 0; j < i - 1; j++) {
      if (j == i - 2) {
        dp[j] = (dp[j - 1] + fact[i - 2]) % MOD;
      } else {
        dp[j] = (dp[j] * (i - 1)) % MOD;
      }
      dp[j] %= MOD;
    }
  }
  for (int i = 0; i < n - 1; i++) {
    ans = ans + (dp[i] * d[i + 1]) % MOD;
  }
  cout << ans;
}
