#include <bits/stdc++.h>
long kaijyo(long n, long x);
int main() {
  long num, i, j;
  long number[100000];
  long sum = 0;
  long kaijyo_num;
  scanf("%ld", &num);
  for (i = 0; i < num; i++) {
    scanf("%ld ", &number[i]);
  }
  for (i = num - 1; i >= 1; i--) {
    kaijyo_num = kaijyo(num, i);
    sum += kaijyo_num * (number[num - 1] - number[i - 1]);
    sum %= 1000000007;
  }
  printf("%ld", sum);
  return 0;
}
long kaijyo(long n, long x) {
  long result = 1;
  int i;
  for (i = 2; i <= n - 1; i++) {
    if (i == x) {
      continue;
    }
    result *= i;
    result %= 1000000007;
  }
  return result;
}
