#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, x, y, m, j, o, a;
  cin >> n;
  long long d[n];
  long long t[n];
  x = 0;
  n -= 1;
  for (i = 0; i <= n; i++) {
    cin >> y;
    d[i] = y - x;
    x = y;
  }
  m = 0;
  t[1] = 1;
  t[0] = 0;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (j != i) {
        t[j] = t[j] * i % 1000000007;
      } else {
        t[j] = (t[1] / i + t[i - 1]) % 1000000007;
      }
    }
  }
  a = 0;
  for (i = 1; i <= n; i++) {
    a = a + t[i] * d[i] % 1000000007;
  }
  cout << a;
}
