#include <bits/stdc++.h>
using namespace std;
const int N=100010,Mod=1e9+7;
int n,a[N];
long long ret=0;
int main() {
freopen("enumerate.in","r",stdin);
freopen("enumerate.out","w",stdout);
cin>>n;
for (int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
for (int i=1;i<=n-3;i++)
{
for (int j=i+2;j<=n-1;j++)
{
for (int k=i+1;k<j;k++)
{
for (int l=j+1;l<=n;l++)
{
ret+=a[i]%Mod*a[j]%Mod*a[k]%Mod*a[l]%Mod;
ret%=Mod;
}
}
}
}
cout<<ret;
}