function Main( input ){

    input = input.split( '\n' )

    var mn = input[0].split( ' ' )
    
    var n = mn[0],
        m = mn[1]
    
    var area = []
    
    var x = input[1].split( ' ' )
    var y = input[2].split( ' ' )
    
    var result = []

    
    var _x, _y
    var x1, x2, y1, y2
    
    _x = x.concat()
    for( ;_x.length!==1; ){
        x1 = _x.shift()
        x2 = _x[0]
        
        _y = y.concat()
        for( ;_y.length!==1; ){
            y1 = _y.shift()
            
            for( var i=0; i<_y.length; i++ ){
                y2 = _y[i]
                result.push( ( y2-y1 ) * (x2-x1) )
            }
        }
        
    }
    
    _y = y.concat()
    for( ;_y.length!==1; ){
        y1 = _y.shift()
        y2 = _y[0]

        _x = x.concat()
        for( ;_x.length!==1; ){
            x1 = _x.shift()
            
            for( var i=0; i<_x.length; i++ ){
                x2 = _x[i]
                result.push( ( y2-y1 ) * (x2-x1) )
            }
        }

    }

    var sum = 0
    for( var i=0; i<result.length; i++ ){
        sum += result[i]
    }
    
    console.log( sum % 1000000007 )
    
}

Main( require( 'fs' ).readFileSync( '/dev/stdin', 'utf8' ) )