
package main

import "fmt"

func main() {
  var n, m int

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

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

  fmt.Println(sum)
}
