#include <bits/stdc++.h>
const int MOD = 1000000007;
using namespace std;
bool sortcol(const vector<int>& v1, const vector<int>& v2) {
  return v1[1] < v2[1];
}
long long int mod_pow(int a, int b, int M = MOD) {
  int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % M;
    a = (a * a) % M;
    b >>= 1;
  }
  return res;
}
long long int ncr(long long int n, long long int r) {
  if (n == 1 || r == 0) return 1;
  if (r > n / 2) r = n - r;
  long long int ans = 1;
  for (long long int i = 1; i <= r; i++) {
    ans = ((ans * n) / i);
    n--;
  }
  return ans;
}
long long int ncrsum(long long int n, long long int r, long long int mod) {
  if (n == 1 || r == 0) return 1;
}
const int maxn = 5e5 + 1000;
long long int vis[300000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  t = 1;
  for (long long int testcase = 0; testcase < t; testcase++) {
    long long int i1, i2, k, j, j1, a1, i31, i3, j2, i5, i4, i6, i7, i, m, n;
    long long int x, y, z;
    long long int total = 0, cnt = 0;
    long long int flag = 0;
    y = 0;
    long long int res, res1, ans, res2, q, sum;
    ans = 0, cnt = 0;
    res1 = 0, res = 0, sum = 0;
    long long int flag1 = 0;
    long long int k1, k2, k3;
    k1 = 1, k2 = 0;
    k3 = 0;
    long long int required, days, h, w;
    cin >> n;
    long long int a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      y = y + a[i];
      y = y % MOD;
    }
    k1 = ((y % MOD) * (y % MOD)) % MOD;
    for (int i = 0; i < n; i++) {
      sum = sum + ((a[i] % MOD) * (a[i] % MOD)) % MOD;
      sum = sum % MOD;
    }
    k3 = (k1 - sum) / 2;
    k3 = k3 % MOD;
    cout << k3 << "\n";
  }
}
