let c = 1000000007

let ans n m =
  let rec sum i n s =
    if i = n then s
    else
      let x = Scanf.scanf " %d" (fun x -> x) in
      sum (i + 1) n ((s + (2 * i - n + 1) * x) mod c)
  in
  sum 0 n 0 * sum 0 m 0 mod c

let () = Scanf.scanf "%d %d" (fun n m -> print_int (ans n m))
