#include <bits/stdc++.h>
using namespace std;
int n, m;
const int N = 500090;
long long tree[4 * N], laz[4 * N], a[N], b[N], vis[N], c[N], pr[N];
void plaz(int ind, int l) {
  tree[ind] += laz[ind];
  if (l > 1) {
    laz[ind * 2 + 1] += laz[ind];
    laz[ind * 2 + 2] += laz[ind];
  }
  laz[ind] = 0;
}
void up(int ind, int st, int end, int l, int r, long long x) {
  plaz(ind, end - st + 1);
  if (l > end || r < st) return;
  if (l <= st && end <= r) {
    laz[ind] = x;
    plaz(ind, end - st + 1);
    return;
  }
  int m = (st + end) / 2;
  up(ind * 2 + 1, st, m, l, r, x);
  up(ind * 2 + 2, m + 1, end, l, r, x);
}
void update(int ind, int st, int end, int uind, long long x) {
  plaz(ind, end - st + 1);
  if (uind > end || uind < st) return;
  if (st == end) {
    tree[ind] = min(tree[ind], x);
    return;
  }
  int m = (st + end) / 2;
  update(ind * 2 + 1, st, m, uind, x);
  update(ind * 2 + 2, m + 1, end, uind, x);
}
long long get(int ind, int st, int end, int u) {
  plaz(ind, end - st + 1);
  if (u > end || u < st) return 1e17;
  if (st == end) return tree[ind];
  int m = (st + end) / 2;
  return min(get(ind * 2 + 1, st, m, u), get(ind * 2 + 2, m + 1, end, u));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> c[i];
  cin >> m;
  pr[0] = c[0];
  for (int i = 0; i < n * 4 + 10; i++) {
    tree[i] = 1e17;
    laz[i] = 0;
  }
  for (int i = 1; i < n; i++) pr[i] = pr[i - 1] + c[i];
  memset(vis, -1, sizeof vis);
  for (int i = 0; i < m; i++) {
    cin >> b[i];
    vis[b[i]] = i;
  }
  for (int i = 0; i < n; i++) {
    if (c[i] > 0)
      up(0, 0, n, 0, a[i] - 1, c[i]);
    else
      up(0, 0, n, 0, n, c[i]);
    if (vis[a[i]] == -1) continue;
    int w = vis[a[i]];
    long long x;
    if (w == 0)
      x = pr[i - 1];
    else
      x = get(0, 0, n, b[w - 1]) - c[i];
    update(0, 0, n, a[i], x);
  }
  long long w = get(0, 0, n, b[m - 1]);
  if (w > 1e15) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl << w;
}
