import std.container;
import std.range;
import std.algorithm;
import std.array;
import std.string;
import std.conv;
import std.stdio;
import std.container;

void main() {
	enum long Mod = 10L ^^ 9L + 7L;
	readln;
	auto a = readln.chomp.split(' ').map!(to!long).array;

	long total;

	foreach (i;0..a.length - 1) {
		foreach (j;i + 1..a.length) {
			auto t = a[i] * a[j];
			total = (total + t) % Mod;
		}
	}

	writeln(total);
}
