let () =
  Scanf.scanf "%d\n" @@ fun n ->
  let arr = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d in
  let ans = ref 0 in
  for i = 0 to n - 2 do
    for j = i + 1 to n - 1 do
      ans := (!ans + (arr.(i) * arr.(j)) mod ((int_of_float(10. ** 9.))+7))
    done;
  done;
  Printf.printf "%d\n" (!ans mod ((int_of_float(10. ** 9.))+7))