#include #include using namespace std; using ll = long long; const ll MOD = 1000000007; int main(){ int n;cin>>n; vector A(n+1); vector B(n+1); for(int i = 0; n >= i; i++){ cin>>A[i]; } for(int i = 0; n >= i; i++){ cin>>B[i]; } vector b(n+2); b[0] = 0; for(int i = 1; n+1 >= i; i++){ b[i] = (b[i-1]+B[i-1]); } ll ans = 0; for(int i = 0; n >= i; i++){ ans = (ans+A[i]*b[n+1-i])%MOD; } cout << ans << endl; }