#include <iostream>
#include <algorithm> // for sort, mainly
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <array>
#include <string>
#include <cstdio>
#include <iterator>
#include <unordered_set>
#include <cstdint> // for int64_t, int32_t, etc
#include <queue>
#include <stack>
#include <deque>
#include <numeric> // gcd, lcm
#include <fstream>
#include <bitset> // for bitset
#include <iomanip>
#include <cassert> // for set with custom ordering
#include <type_traits> // for set with custom ordering
#include <utility> // for swap, forward, etc
using namespace std;
#pragma GCC optimize("O2")
// #pragma GCC optimize("O1","O2","O3","Ofast","unroll-loops")
// #pragma GCC target("sse","sse2","sse3","sse4.1","sse4.2","avx","avx2","fma")
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cout << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cout << ' ' << H; dbg_out(T...); }
#ifdef LOCAL
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif
/*
notes:
int64_t
stoi(string s) -> string to int
to_string() -> int (or else) to string
vector declaration:
vector<ll> v(n, 0)
vector<vector<ll>> v(n, vector<ll>(n, 0));
{if statement} ? {truth value} : {false value}
#ifdef LOCAL
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
#endif
std::lcm(ll a, ll b), std::gcd(int a, int b)
cout << fixed << setprecision(n);
set with custom ordering
set<ll, decltype(&cmp)> qu(cmp);
*/
typedef int64_t ll;
// 60 pont
void solve() {
ll n, m;
cin >> n;
vector<ll> w(n, 0);
for(ll i = 0; i < n; i++) {
cin >> w[i];
}
ll ans = 0;
cin >> m;
vector<ll> maxcount(m, 0);
vector<ll> maxweight(m, 0);
map<ll,ll> pref; // for k items, the strongest frog
set<ll> c;
for(ll i = 0; i < m; i++) {
cin >> maxcount[i];
c.insert(maxcount[i]);
}
for(ll i = 0; i < m; i++) {
cin >> maxweight[i];
pref[maxcount[i]] = max(pref[maxcount[i]], maxweight[i]);
}
//map<ll,ll> pref;
ll lastind = *c.rbegin();
ll pr = pref[lastind];
for(auto it = c.rbegin(); it != c.rend(); it++) {
pr = max(pr, pref[*it]);
pref[*it] = pr;
}
//cerr << "\npref=" << pref;
for(ll i = 0; i < n; i++) {
//cerr << "\ni=" << i;
ll cw = 0;
ans++;
for(ll j = i; j < n; j++) {
//cerr << "\nj=" << j;
// melyik a legutolso j, amit el tudunk vinni egy beka felhasznalasaval?
cw += w[j];
bool e = false;
ll am = j - i + 1;
if(c.count(am)) {
if(pref[am] >= cw) {
e = true;
}
}else{
if(am <= *c.rbegin()) {
ll nam = *c.upper_bound(am);
if(pref[nam] >= cw) {
e = true;
}
}
}
/*
for(ll k = 0; k < m; k++) {
// van-e olyan beka ami ezt el tudja vegezni
if(maxcount[k] >= j - i + 1 && maxweight[k] >= cw) {
e = true;
break;
}
}
*/
//cerr << "\ne=" << e;
if(e == false) {
i = j - 1;
break;
}
if(j == n - 1) {
//cerr << "\nend";
i = n+1;
break;
}
}
}
cout << ans;
}
int main()
{
std::ios_base::sync_with_stdio(false);
//cin.tie(nullptr);
//cout.tie(nullptr);
solve();
return 0;
}