For this Question: You are given an array of N integers A1, A2,. . An. You have to calculate prosum of the array.
Prosum is defined as the sum of all Ai x Aj over all pairs (i, j) such that 1 <= i < j <= N, modulo (10^9 + 7)The first line of the input contains a single integer N
The next line of the input contains N different integers A1, A2,. . An

Constraints:
 1) 2 <= N <= 2 x 10^5
 2) 0 <= Ai <= 10^9Print the answerSample Input 1:
4
1 2 3 4

Sample Output 1:
35

Explanation:
1 x 2 + 1 x 3 + 1 x 4 + 2 x 3 + 2 x 4 + 3 x 4 = 35


Sample Input 2:
4
141421356 17320508 22360679 244949

Sample Output 2:
437235829, I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for (int i = a; i < (int)(n); i++)

int main() {
  long long N, M=1000000007,  Sum=0, Ans=0;
  cin >> N;
  long long A[N];
  rep(i, 0, N){
    cin >> A[i];
    Sum=(Sum+A[i])%M;
  }
  rep(i, 0, N-1){
    Sum-=A[i];
    if(Sum<0) Sum+=M; 
    Ans=(Ans+A[i]*Sum%M)%M;
  }
  cout << Ans << endl;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?