#include <bits/stdc++.h>
using namespace std;
class Mods {
 private:
  int mod;

 public:
  int fact[100001];

 public:
  Mods(int len, int m) {
    fact[0] = fact[1] = 1;
    mod = m;
    for (int i = 2; i <= len; i++) {
      fact[i] = modMult(fact[i - 1], i);
    }
  }

 public:
  int modSum(int a, int b) { return (int)(((long)a + (long)b) % mod); }

 public:
  int modMult(int a, int b) {
    return (int)((((long)a * (long)b) % mod + mod) % mod);
  }

 private:
  int pow2(int a, int times) {
    if (times == 0)
      return a;
    else
      return pow2((int)((long)a * (long)a % mod), times - 1);
  }

 public:
  int modPow(int a, int b) {
    int output = 1;
    if (b == 0) return 1;
    for (int i = 0; i < log(b) / log(2) + 1; i++) {
      if ((b & (int)pow(2, i)) > 0) {
        output = modMult(pow2(a, i), output);
      }
    }
    return output;
  }

 public:
  int modDivide(int a, int b) { return modMult(a, modPow(b, mod - 2)); }

 public:
  int modNCR(int n, int r) {
    if (n < r) return 0;
    if (n == r) return 1;
    return modDivide(modDivide(fact[n], fact[r]), fact[n - r]);
  }
};
int main() {
  int n;
  cin >> n;
  int x[100001];
  Mods m(n + 1, 1000000007);
  int ans = 0;
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      ans = m.modSum(
          ans, m.modMult(
                   m.modMult(x[j] - x[j - 1], m.fact[j - i - 1]),
                   m.modMult(m.fact[n - (j - i) - 1], m.modNCR(n - 1, j - i))));
    }
  }
  cout << ans << endl;
  return 0;
}
