function Main(input) {
    tmp = input.split("\n");
    n = parseInt(tmp[0], 10);
    a = tmp[1].split(" ").map(Number);
    MOD = 1000000007;
	result = 0;

    for (let i = 0; i < n; i++) {
                  
        for (let j = 1; j < n; j++) {
			num1 = a[i] % MOD;
            num2 = a[j] % MOD;

            if (i < j) {                
           		result += (num1  * num2) % MOD;
            	result = result % MOD
            }
        }        
    }
    
    console.log(result);

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));