#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> vl(n);
  const long long mod = 1000000007;
  long long he = 0;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    he += a;
    vl[i] = a;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    long long cnt = 0;
    long long ch = (he - vl[i]) % mod;
    cnt = ((ch)*vl[i]) % mod;
    ans += cnt;
  }
  cout << (ans / 2) % mod << endl;
  return 0;
}
