#include #define rep(i,a,b) for(int i=int(a);i> N; vector A(N+2),B(N+1); rep(i,0,N+1){ int a; cin >> a; A[i+1] = A[i] + a; } rep(i,0,N+1){ cin >> B[i]; } ll sum = 0; rep(i,0,N+1){ sum = (sum + B[i] * (A[N-i+1] % MOD) ) % MOD; } cout << sum << endl; }