#include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ long n,m; cin>>n; long p[n+1],x[n+1],a[n+1]={}; for(long i=1;i<=n;i++) cin>>p[i]; for(long i=1;i<=n;i++) cin>>x[i]; cin>>m; long xc[m+1],r[m+1]; for(long i=1;i<=m;i++) cin>>xc[i]; for(long i=1;i<=m;i++) { cin>>r[i]; a[xc[i]]++; for(long j=1;j<=r[i];j++) {a[xc[i]+j]++; a[xc[i]-j]++;} } long cnt=0,temp=0; for(long i=1;i<=n;i++) {if(a[i]==0) cnt+=p[i];} for(long i=1;i<=n;i++){ if(a[i]==1) temp=max(temp,p[i]); } cout<