#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); for (int i = 0; i < n+1; i++) { cin>>a[i]; } for (int i = 0; i < n+1; i++) { cin>>b[i]; } ll res = 0; for (int i = 0; i < n+1; i++) { for (int j = 0; j < i/2+1; j++) { if(j==i-j)(res+=a[j]*b[i-j])%=MOD; else (res+=(a[j]*b[i-j]+b[j]*a[i-j])%MOD)%=MOD; } } cout<