#include <iostream>
using namespace std;
int main(void){
    const long long  MOD=1e9+7;
    long long  n,asum[100000+1]={0},b,ans=0;
    cin >> n;
    for(int i=0;i<=n;i++){
        cin >> asum[i];
        if(i>0) asum[i]=(asum[i-1]+asum[i])%MOD;
    }
    for(int i=0;i<=n;i++){
        cin >> b;ans=(ans+b*asum[n-i])%MOD;
    }
    cout << ans << endl;
    return 0;
}