#include using namespace std; #define rep(i,n) for(int i=0;i>n; vector a(n+1),b(n+1); rep(i,n+1)cin>>a[i]; rep(j,n+1)cin>>b[j]; vector sumb(n+2); rep(i,n+1)sumb[i+1]=sumb[i]+b[i]; i64 sum = 0; for(int i=0;i<=n;++i){ sum += a[i]*(sumb[n-i+1]%mod)%mod; sum %= mod; } cout<<(sum)<