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: #!/usr/bin/env python3
  
  import sys
  
  read = sys.stdin.buffer.read
  readline = sys.stdin.buffer.readline
  readlines = sys.stdin.buffer.readlines
  sys.setrecursionlimit(10**7)
  
  MOD = 10**9 + 7
  
  
  class ModInt:
      def __init__(self, x):
          self.x = x % MOD
  
      def __str__(self):
          return str(self.x)
  
      __repr__ = __str__
  
      def __add__(self, other):
          return (
              ModInt(self.x + other.x)
              if isinstance(other, ModInt)
              else ModInt(self.x + other)
          )
  
      def __sub__(self, other):
          return (
              ModInt(self.x - other.x)
              if isinstance(other, ModInt)
              else ModInt(self.x - other)
          )
  
      def __mul__(self, other):
          return (
              ModInt(self.x * other.x)
              if isinstance(other, ModInt)
              else ModInt(self.x * other)
          )
  
      def __truediv__(self, other):
          return (
              ModInt(self.x * pow(other.x, MOD - 2, MOD))
              if isinstance(other, ModInt)
              else ModInt(self.x * pow(other, MOD - 2, MOD))
          )
  
      def __pow__(self, other):
          return (
              ModInt(pow(self.x, other.x, MOD))
              if isinstance(other, ModInt)
              else ModInt(pow(self.x, other, MOD))
          )
  
      __radd__ = __add__
  
      def __rsub__(self, other):
          return (
              ModInt(other.x - self.x)
              if isinstance(other, ModInt)
              else ModInt(other - self.x)
          )
  
      __rmul__ = __mul__
  
      def __rtruediv__(self, other):
          return (
              ModInt(other.x * pow(self.x, MOD - 2, MOD))
              if isinstance(other, ModInt)
              else ModInt(other * pow(self.x, MOD - 2, MOD))
          )
  
      def __rpow__(self, other):
          return (
              ModInt(pow(other.x, self.x, MOD))
              if isinstance(other, ModInt)
              else ModInt(pow(other, self.x, MOD))
          )
  
  
  N = int(input())
  A = list(map(int, input().split()))
  
  A = [ModInt(a) for a in A]
  
  A_d = [a * a for a in A]
  
  res = sum(A) ** 2 - sum(A_d)
  
  res = int(str(res))
  res //= 2
  print(res)
  
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"}]