#-swank
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "128MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))


(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 (1- N)))
(defparameter coeff
  (loop for i from 1 below N
        collect (apply #'+
                       (loop for j from 1 to i
                             collect (/ 1 j)))))

(defun add-lst (lst1 lst2)
  (if (null lst1)
      0
      (+ (* (car lst1) (car lst2))
         (add-lst (cdr lst1) (cdr lst2)))))

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

