let base = 1000000007

let rec input n =
    if n <= 0
    then []
    else Scanf.scanf " %d" (fun x -> x :: (input (n - 1)))

let calc a n = List.fold_left (fun x y -> (x + y) mod base) 0 (List.mapi (fun i x -> (x * (n - 1 - 2 * i)) mod base) a)

let () =
    let (n, m) = Scanf.scanf "%d %d" (fun x y -> x, y) in
    let xs = input n in
    let ys = input m in
    let x_combi = calc xs n in
    let y_combi = calc ys m in
    print_int ((x_combi * y_combi) mod base);
    print_newline ();;
