let as_num_list s =
  let splitted = String.split_on_char ' ' s in
  List.map int_of_string splitted

let main () =
  let n = Scanf.sscanf (read_line ()) "%d" (fun x -> x) in
  let as_str = read_line () in
  let a_list = as_num_list as_str in
  let sum = ref 0 in
  (
    for i = 0 to n - 2 do
      for j = i + 1 to n - 1 do
        sum := (!sum +
                  (List.nth a_list i) * (List.nth a_list j)) mod 1000000007
      done
    done;
    Printf.printf "%d" !sum;
    print_newline ()
  )

let _ = main ()
