#include #include #include #include #include #include #include #include #include #include #include #include #define vll vector #define vvvl vector #define vvl vector> #define VV(a, b, c, d) vector>(a, vector(b, c)) #define VVV(a, b, c, d) vector(a, vvl(b, vll (c, d))); #define re(c, b) for(ll c=0;c> n; ll P = 1000000007; vll a(n+1),b(n+1), L(n+1,0); get(a); get(b); for(int i=0;i<=n;i++) L[i] = ((i==0?0:L[i-1]) + a[i])%P; ll ans = 0; for(int i=0;i<=n;i++){ ans = (ans + (b[i]*L[n-i])%P)%P; } std::cout << ans << '\n'; return 0; }