#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const long long inf = 1e18;
const int mo = 998244353;
int n;
long long a0;
long long a[N], p[N];
int s[N], ls[N];
void f(int x, long long y) {
  for (; x <= n; x += x & -x) a[x] += y;
}
long long q(int x) {
  long long r = a0;
  for (; x; x -= x & -x) r += a[x];
  return r;
}
int main() {
  int m;
  scanf("%d", &n);
  for (auto i = (1); i <= (n); ++i) scanf("%d", &s[i]);
  for (auto i = (1); i <= (n); ++i) scanf("%lld", &p[i]);
  scanf("%d", &m);
  int LS = 0;
  for (auto i = (0); i <= (n); ++i) ls[i] = -1;
  for (auto i = (1); i <= (m); ++i) {
    int x;
    scanf("%d", &x);
    ls[x] = LS;
    LS = x;
  }
  f(1, inf);
  for (auto i = (1); i <= (n); ++i) {
    long long res;
    if (~ls[s[i]]) res = q(ls[s[i]]);
    a0 += p[i];
    if (p[i] > 0) f(s[i], -p[i]);
    if (~ls[s[i]]) {
      long long nw = q(s[i]);
      if (res < nw) {
        f(s[i], res - nw);
        if (s[i] < n) f(s[i] + 1, nw - res);
      }
    }
  }
  long long ans = q(LS);
  if (ans >= inf / 2)
    printf("NO\n");
  else
    printf("YES\n%lld\n", ans);
}
