#include using namespace std; using ll=long long; #define rep2(i, a, n) for(int i = (a); i < (n); i++) #define rep(i, n) rep2(i,0,n) #define mod 1000000007 int main(){ cin.tie(nullptr);ios_base::sync_with_stdio(false); int n;cin>>n; n++; ll a[n],b[n],pref[n]; rep(i,n)cin>>a[i]; rep(i,n)cin>>b[i]; rep(i,n){ pref[i]=b[i]; if(i)pref[i]=(pref[i]+pref[i-1])%mod; } ll ans=0; rep(i,n){ ans+=a[i]*pref[n-1-i]%mod; ans%=mod; } cout<