#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair p_ii; const int INF = 1e9; const double PI = acos(-1.0); const ll MOD = 1e9 + 7; int main() { int n; cin>>n; vector a(n+1), b(n+1), sum(n+1, 0); for (int i = 0; i < n+1; i++) { cin>>a[i]; } for (int i = 0; i < n+1; i++) { cin>>b[i]; } sum[0]=b[0]; for (int i = 0; i < n; i++) { sum[i+1]=sum[i]+b[i+1]; } ll res = 0; for (int i = 0; i < n+1; i++) { (res+=a[i]*sum[n-i])%=MOD; } cout<