output_description: Print \sum_{i=1}^{N-1}\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      A_1 \ldots A_N
attempt: # Date [ 2020-08-29 21:10:46 ]
  # Problem [ c.py ]
  # Author Koki_tkg
  
  import sys
  
  # import math
  # import bisect
  # import numpy as np
  # from decimal import Decimal
  # from numba import njit, i8, u1, b1 #JIT compiler
  # from itertools import combinations, product
  # from collections import Counter, deque, defaultdict
  
  # sys.setrecursionlimit(10 ** 6)
  MOD = 10**9 + 7
  INF = 10**9
  PI = 3.14159265358979323846
  
  
  def read_str():
      return sys.stdin.readline().strip()
  
  
  def read_int():
      return int(sys.stdin.readline().strip())
  
  
  def read_ints():
      return map(int, sys.stdin.readline().strip().split())
  
  
  def read_ints2(x):
      return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
  
  
  def read_str_list():
      return list(sys.stdin.readline().strip().split())
  
  
  def read_int_list():
      return list(map(int, sys.stdin.readline().strip().split()))
  
  
  def GCD(a: int, b: int) -> int:
      return b if a % b == 0 else GCD(b, a % b)
  
  
  def LCM(a: int, b: int) -> int:
      return (a * b) // GCD(a, b)
  
  
  def Main():
      n = read_int()
      a = read_int_list()
  
      ans = 0
  
      total = sum(a)
      for i in range(n):
          ans += (a[i] * (total - a[i])) / 2
          ans %= MOD
  
      print(int(ans % MOD))
  
  
  if __name__ == "__main__":
      Main()
  
problem_description: Statement
  
  Given are N integers A_1,\ldots,A_N.
  
  Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq
  N, modulo (10^9+7).
samples: [{"input": "3\n    1 2 3", "output": "11\n    \n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\n* * *"}, {"input": "4\n    141421356 17320508 22360679 244949", "output": "437235829"}]