import io.StdIn.readLine
object Main extends App {
  val mod = 1000000007
  val Array(n, m) = readLine.split(" ").map(_.toInt)
  val xs = readLine.split(" ").toSeq.map(_.toLong)
  val ys = readLine.split(" ").toSeq.map(_.toLong)
  println((for (i <- 0 until (n - 1);
                k <- 0 until (m - 1))
   yield {
    (xs(i + 1) - xs(i)) * (ys(k + 1) - ys(k)) % mod * (i + 1) * (n - i - 1) * (k + 1) * (m - k - 1) % mod
  }).reduce((res, s) => (res + s) % mod))
}
