#include #define R for(i=0;i<=n;++i) using namespace std;main(){int n,i;scanf("%d",&n);long a[n+1],b[n+1],sum=0,ans=0;R cin>>a[i];R cin>>b[i];R{sum+=a[i];ans=(ans+sum*b[n-i])%1000000007;}cout<