#include <bits/stdc++.h>
using namespace std;
struct Word {
  string str;
  int val;
  int grp = -1;
  bool operator<(const Word b) const { return this->val < b.val; }
} word[100005];
bool cmp(Word A, Word B) { return A.str < B.str; }
int find(string pur, int l, int r) {
  int mid = (l + r) / 2;
  if (word[mid].str == pur)
    return mid;
  else {
    if (pur < word[mid].str)
      return find(pur, l, mid - 1);
    else
      return find(pur, mid + 1, r);
  }
}
set<Word> group[100005];
int main() {
  long long sum = 0;
  int n, k, m;
  cin >> n >> k >> m;
  int i, j;
  for (i = 1; i <= n; i++) cin >> word[i].str;
  for (i = 1; i <= n; i++) cin >> word[i].val;
  for (i = 1; i <= k; i++) {
    int num;
    cin >> num;
    for (j = 1; j <= num; j++) {
      int no;
      cin >> no;
      word[no].grp = i;
      group[i].insert(word[no]);
    }
  }
  sort(word + 1, word + n + 1, cmp);
  for (i = 1; i <= m; i++) {
    string temp;
    int gaizu;
    cin >> temp;
    int paimin = find(temp, 1, n);
    gaizu = word[paimin].grp;
    if (gaizu == -1) sum += word[paimin].val;
    sum += (*group[gaizu].begin()).val;
  }
  cout << sum;
  return 0;
}
