#include <bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
long long a[100010],res;
int n;
int main () {
freopen("enumerate.in","r",stdin);
freopen("enumerate.out","w",stdout);
scanf("%d",&n);
for (int i=1;i<=n;i++) scanf("%lld",&a[i]);
for (int i=1;i<=n;i++) {
for (int j=i+1;j<=n;j++) {
for (int k=j+1;k<=n;k++) {
for (int v=k+1;v<=n;v++) {
int sum=1;
sum=sum*a[i]%mod;
sum=sum*a[j]%mod;
sum=sum*a[k]%mod;
sum=sum*a[v]%mod;
res+=sum;
res%=mod;
}
}
}
}
cout << res <<endl;
return 0;
}