fun main(args: Array<String>?): Unit {
    val mod = 1000000007L
    val (n, m) = readLine()!!.trim().split(' ').map(String::toInt)
    val stripes = readLine()!!.trim().split(' ').map(String::toLong).toLongArray()
    val borders = readLine()!!.trim().split(' ').map(String::toLong).toLongArray()
    var xSum = 0L
    for (i in stripes.indices.drop(1)) {
        xSum += stripes[i] * i % mod - stripes[i - 1]
        stripes[i] += stripes[i - 1] % mod
        xSum %= mod
    }
    var ySum = 0L
    for (i in borders.indices.drop(1)) {
        ySum += borders[i] * i % mod - borders[i - 1]
        borders[i] += borders[i - 1] % mod
        ySum %= mod
    }
    println((xSum * ySum % mod + mod) % mod)
}
