output_description: Print the total area of the rectangles, modulo 10^9+7.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      n m
      x_1 x_2 ... x_n
      y_1 y_2 ... y_m
attempt: #
  # 　　  ⋀_⋀
  # 　　  (･ω･)
  # .／ Ｕ ∽ Ｕ＼
  #  │＊　合　＊│
  #  │＊　格　＊│
  #  │＊　祈　＊│
  #  │＊　願　＊│
  #  │＊　　　＊│
  #      ￣
  #
  import sys
  
  sys.setrecursionlimit(10**6)
  input = sys.stdin.readline
  from math import floor, ceil, sqrt, factorial, hypot, log  # log2ないｙｐ
  from heapq import heappop, heappush, heappushpop
  from collections import Counter, defaultdict, deque
  from itertools import (
      accumulate,
      permutations,
      combinations,
      product,
      combinations_with_replacement,
  )
  from bisect import bisect_left, bisect_right
  from copy import deepcopy
  
  inf = float("inf")
  mod = 10**9 + 7
  
  
  def pprint(*A):
      for a in A:
          print(*a, sep="\n")
  
  
  def INT_(n):
      return int(n) - 1
  
  
  def MI():
      return map(int, input().split())
  
  
  def MF():
      return map(float, input().split())
  
  
  def MI_():
      return map(INT_, input().split())
  
  
  def LI():
      return list(MI())
  
  
  def LI_():
      return [int(x) - 1 for x in input().split()]
  
  
  def LF():
      return list(MF())
  
  
  def LIN(n: int):
      return [I() for _ in range(n)]
  
  
  def LLIN(n: int):
      return [LI() for _ in range(n)]
  
  
  def LLIN_(n: int):
      return [LI_() for _ in range(n)]
  
  
  def LLI():
      return [list(map(int, l.split())) for l in input()]
  
  
  def I():
      return int(input())
  
  
  def F():
      return float(input())
  
  
  def ST():
      return input().replace("\n", "")
  
  
  # mint
  class ModInt:
      def __init__(self, x):
          self.x = x % mod
  
      def __str__(self):
          return str(self.x)
  
      __repr__ = __str__
  
      def __add__(self, other):
          if isinstance(other, ModInt):
              return ModInt(self.x + other.x)
          else:
              return ModInt(self.x + other)
  
      __radd__ = __add__
  
      def __sub__(self, other):
          if isinstance(other, ModInt):
              return ModInt(self.x - other.x)
          else:
              return ModInt(self.x - other)
  
      def __rsub__(self, other):
          if isinstance(other, ModInt):
              return ModInt(other.x - self.x)
          else:
              return ModInt(other - self.x)
  
      def __mul__(self, other):
          if isinstance(other, ModInt):
              return ModInt(self.x * other.x)
          else:
              return ModInt(self.x * other)
  
      __rmul__ = __mul__
  
      def __truediv__(self, other):
          if isinstance(other, ModInt):
              return ModInt(self.x * pow(other.x, mod - 2, mod))
          else:
              return ModInt(self.x * pow(other, mod - 2, mod))
  
      def __rtruediv(self, other):
          if isinstance(other, self):
              return ModInt(other * pow(self.x, mod - 2, mod))
          else:
              return ModInt(other.x * pow(self.x, mod - 2, mod))
  
      def __pow__(self, other):
          if isinstance(other, ModInt):
              return ModInt(pow(self.x, other.x, mod))
          else:
              return ModInt(pow(self.x, other, mod))
  
      def __rpow__(self, other):
          if isinstance(other, ModInt):
              return ModInt(pow(other.x, self.x, mod))
          else:
              return ModInt(pow(other, self.x, mod))
  
  
  def main():
      N, M = MI()
      X = LI()
      Y = LI()
      ans = ModInt(0)
      for i, x in enumerate(X[:-1]):
          for j, y in enumerate(Y[:-1]):
              s = (X[i + 1] - x) * (Y[j + 1] - y)
              print(s, (i + 1) * (N - (i + 1)) * (j + 1) * (M - (j + 1)) * s)
              ans += (i + 1) * (N - (i + 1)) * (j + 1) * (M - (j + 1)) * s
      print(ans)
  
  
  if __name__ == "__main__":
      main()
  
problem_description: Statement
  
  On a two-dimensional plane, there are m lines drawn parallel to the x axis,
  and n lines drawn parallel to the y axis. Among the lines parallel to the x
  axis, the i-th from the bottom is represented by y = y_i. Similarly, among the
  lines parallel to the y axis, the i-th from the left is represented by x =
  x_i.
  
  For every rectangle that is formed by these lines, find its area, and print
  the total area modulo 10^9+7.
  
  That is, for every quadruple (i,j,k,l) satisfying 1\leq i < j\leq n and 1\leq
  k < l\leq m, find the area of the rectangle formed by the lines x=x_i, x=x_j,
  y=y_k and y=y_l, and print the sum of these areas modulo 10^9+7.
samples: [{"input": "3 3\n    1 3 4\n    1 3 6", "output": "60\n    \n\nThe following figure illustrates this input:\n\n![sample1-1](https://atcoder.jp/img/arc071/aec4d5cc2e5c73dbee455be237a649a5.png)\n\nThe total area of the nine rectangles A, B, ..., I shown in the following\nfigure, is 60.\n\n![sample1-2](https://atcoder.jp/img/arc071/f0771c0f7e68af2b00e7513186f585ff.png)\n\n* * *"}, {"input": "6 5\n    -790013317 -192321079 95834122 418379342 586260100 802780784\n    -253230108 193944314 363756450 712662868 735867677", "output": "835067060"}]