(defun split-with (string &key (delimiterp #'(lambda (c) (char= c #\Space))))
  (loop :for beg = (position-if-not delimiterp string)
        :then (position-if-not delimiterp string :start (1+ end))
        :for end = (and beg (position-if delimiterp string :start beg))
        :when beg :collect (subseq string beg end)
        :while end))

(destructuring-bind (n m) (mapcar #'parse-integer (split-with (read-line)))

  (let* ((a (- n 1))
         (b (- m 1))
         (xs (make-array n :initial-contents
                         (mapcar #'parse-integer (split-with (read-line)))))
         (ys (make-array m :initial-contents
                         (mapcar #'parse-integer (split-with (read-line)))))
         (hor (make-array a :initial-contents
                          (loop :for i :from 0 :below (- n 1)
                                :collect (- (aref xs (+ i 1)) (aref xs i)))))
         (ver (make-array b :initial-contents
                          (loop :for j :from 0 :below (- m 1)
                                :collect (- (aref ys (+ j 1)) (aref ys j)))))
         (sum 0))
    (loop :for xcell :from 1 :to a
          :do (loop :for xoffset :from 0 :to (- a xcell)
                    :for xlen = (loop :for i :from 0 :below xcell
                                      :summing (aref hor (+ xoffset i)))
                    :do (loop :for ycell :from 1 :to b
                              :do (loop :for yoffset :from 0 :to (- b ycell)
                                        :for ylen = (loop :for j :from 0 :below ycell
                                                          :summing (aref ver (+ yoffset j)))
                                        :do (setf sum (mod (+ sum (* xlen ylen)) 1000000007))))))
  (format t "~d~%" sum)))
