#include #define rep(i,n) for(int i=0;i<(n);++i) #define all(a) (a).begin(),(a).end() #define dunk(a) cout << (a) << endl using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); ll mod = 1000000007; int n; cin >> n; vector a(n + 1); vector b(n + 1); rep(i, n + 1) cin >> a[i]; rep(i, n + 1) cin >> b[i]; ll ans = 0; rep(i, n + 1) { rep(j, n + 1) { if (i + j < n + 1) { ans += a[i] * b[j]; ans %= mod; } } } dunk(ans); return 0; }