#include using namespace std; int main() { int n; cin >> n; vector a(n + 1), b(n + 1), s(n + 2); for (int i = 0; i <= n; i++) cin >> a.at(i); for (int i = 0; i <= n; i++) cin >> b.at(i); for (int i = 0; i <= n; i++) { s.at(i + 1) = s.at(i) + a.at(i); } int64_t ans = 0, mod = 1000000007; for (int i = 0; i <= n; i++) { ans += s.at(i) * b.at(n - i); ans %= mod; } cout << ans << endl; }