main(){ int n; short i; scanf("%d",&n); long long a[n+1],b[n+1],sum=0,ans=0; for(i=0;i<=n;++i)scanf("%lld",&a[i]); for(i=0;i<=n;++i)scanf("%lld",&b[i]); for(i=0;i<=n;++i){ sum+=a[i]; ans=(ans+sum*b[n-i])%1000000007; } printf("%lld\n",ans); }