#include<iostream>
using namespace std;
int n;
long long ans;
long long lis[100010];
long long mp[100010][5];
const long long MD=1e9+7;
int main(){
freopen("enumerate.in","r",stdin);
freopen("enumerate.out","w",stdout);
mp[0][0]=1;
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%lld",&lis[i]);
for(int i=1;i<=n;i++){
for(int j=0;j<=4;j++){
if(j==0) mp[i][j]=1;
else mp[i][j]=(mp[i-1][j]+mp[i-1][j-1]*lis[i]%MD)%MD;
}
}
printf("%lld",mp[n][4]);
return 0;
}