
package main

import "fmt"

func main() {
  var n, m int64

  fmt.Scanf("%d %d", &n, &m)
  xs := make([]int64, n)
  ys := make([]int64, m)
  for i := 0; int64(i) < n; i++ {
    fmt.Scanf("%d", &(xs[i]))
  }
  for i := 0; int64(i) < m; i++ {
    fmt.Scanf("%d", &(ys[i]))
  }

  sum := int64(0)
  for i := 0; int64(i) < n-1; i++ {
    for j := i+1; int64(j) < n; j++ {
      p := int64(0)
      for k := 0; int64(k) < m-1; k++ {
        p = p + ((xs[j]-xs[i])*(ys[k+1]-ys[k]))*int64(k+1)
        sum = sum + p
      }
    }
  }

  fmt.Println(sum % (1000000000 + 7))
}
