#include using namespace std; using ll = long long; const ll MOD = 1000000007; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector a(n + 1); ll s = 0; for (int i = 0; i <= n; i++) { cin >> a[i]; (s += a[i]) %= MOD; } ll ans = 0; for (int i = 0; i <= n; i++) { ll x; cin >> x; (ans += x * s % MOD) %= MOD; (s += MOD - a[n - i]) %= MOD; } cout << ans << endl; return 0; }