function Main(input) {
	var C = 1e+9 + 7;
	var C2 = 1e+5;	
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});
	let N = parseInt(input[0][0], 10);
	let A = input[1].map(e => parseInt(e, 10));
	let ruisekiwa = [0];
	for (let i = 0; i < N; i++){
		ruisekiwa.push((ruisekiwa[i] + A[i]) % C);
	}
	// console.log(ruisekiwa);

	let ans = 0;
	for (let i = 0; i < (N - 1); i++){
		ans += kakeruR(A[i], mod(ruisekiwa[N] - ruisekiwa[i + 1],C), C, C2);
		ans = mod(ans, C)
	}
	console.log(ans);
}

function mod (i, j){
	return(i % j) < 0 ? (i % j) + 0 + (j < 0 ? -j : j) : (i % j + 0);
}

function kakeruR(a, b, C, C2){
    var tmpQ, tmpR, ans;
    tmpQ = Math.floor(b / C2);  // CAUTION!!
    tmpR = b - (tmpQ * C2);
    ans = (a * tmpQ % C) * C2 % C + (a * tmpR);
    ans %= C;
    return ans;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
