#include <bits/stdc++.h>
using namespace std;
const unsigned long long maxn = 105;
const unsigned long long mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  unsigned long long n, i, j, k, ans = 0;
  cin >> n;
  vector<unsigned long long> a(n + 1), p(n + 1);
  for (i = 1; i <= n; ++i) {
    cin >> a[i];
    if (i > 1) {
      p[i] = p[i - 1] + a[i];
    } else
      p[1] = a[1];
  }
  unsigned long long term;
  p[n] %= mod;
  for (i = 1; i <= n; i++) {
    p[i] %= mod;
    term = ((a[i] * p[n]) % mod - (a[i] * p[i]) % mod) % mod;
    ans = (ans % mod + term % mod) % mod;
  }
  cout << ans;
}
