let n = 1000000007
let ( *^ ) x y = x * y mod n
let ( +^ ) x y = (x + y) mod n

let () =
  let n, m = Scanf.scanf "%d %d\n" (fun n m -> n, m) in
  let xs = Array.init n (fun i -> Scanf.scanf "%d " (fun x -> (2 * i + 1 - n) *^ x)) in
  let ys = Array.init m (fun i -> Scanf.scanf "%d " (fun y -> (2 * i + 1 - m) *^ y)) in
  Printf.printf "%d\n" @@ Array.fold_left ( +^ ) 0 xs *^ Array.fold_left ( +^ ) 0 ys