import 'dart:io';

import 'dart:math';

List<String> getStdStr() => stdin.readLineSync().split(' ');
List<int> getStdInt() {
  var strings = getStdStr();
  List<int> outs = [];
  for (var out in strings) {
    outs.add(int.parse(out));
  }
  return outs;
}

void main() {
  var N = getStdInt();
  var A = getStdInt();
  int sum = 0;
  for (var i = 0; i < N[0] - 1; ++i) {
    for (var j = i + 1; j < N[0]; ++j) {
      sum = mymod(sum + mymod(A[i] * A[j]));
    }
  }
  print(sum);
}

int mymod(int a) => a % 1000000007;

