#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
ll gcd(ll a,ll b){
  if(b==0) return a;
  return gcd(b,a%b);
}
ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}

int main() {
  int n;
  cin >> n;
  ll x[n];
  rep(i,n)cin >> x[i];
  ll f=1e9+7;
  ll dp[1e5+1][1e5+1];
  dp[0][1]=1;
  dp[1][1]=1;
  rep1(i,n){
    dp[i][0]=0;
    dp[i][1]=(dp[i-1][1]*i)%f;
    for(int j=2; j<=i; ++j){
      dp[i][j]=((i-j)*dp[i-1][j]+j*dp[i-1][j-1]+dp[i-1][1])%f;
    }
  }
  ll d[n+1];
  d[0]=0;
  rep1(i,n-1)d[i]=(x[i]-x[i-1])%f;
  ll sum=0;
  rep1(i,n-1)sum+=(dp[n-1][i]*d[i])%f;
  cout << sum%f ;
}
