(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))

(defun fact (n)
  (if (= n 1)
      1
      (* n (fact (1- n)))))

(defparameter N (parse-integer (read-line)))
(defparameter lst
  (mapcar #'parse-integer (split " " (read-line))))
(defparameter const (+ 7 (expt 10 9)))
(defparameter dists
  (loop for i from 0 below (1- N)
        collect (- (nth (1+ i) lst) (nth i lst))))
(defparameter f (fact N))
(defparameter coeff
  (loop for i from 1 below N
        collect (* f
                   (apply #'+
                          (loop for j from 1 to i
                                collect (/ 1 j))))))

(format t "~A" (mod (add-lst coeff dists) const))