#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 sum1 = 0; for(int i=0;i<=n;++i){ sum1 += a[i]*sumb[i+1]; sum1 %= mod; } /* i64 sum2 = 0; for(int i=0;i<=n;++i){ i64 tmp = 0; for(int j=0;j<=n-i;++j){ tmp += b[j]; } sum2 += a[i]*tmp; } */ cout<<(sum1)<