#include #include #include #include #include #include #include #include using namespace std; int main() { long long n, mod, ans = 0; cin >> n; mod = 1e9+7; vector a(n+1), b(n+1); for (long long i = 0; i < n+1; i++) cin >> a[i]; for (long long i = 0; i < n+1; i++) cin >> b[i]; for (long long i = 0; i < n+1; i++){ for (int j = 0; j <= i; j++){ ans += (a[j] * b[i-j])%mod; ans %= mod; } } cout << ans << endl; }