#include <bits/stdc++.h>
struct rec {
  std::string str;
  int index;
};
int n, m, k;
const int MAX_LEN = 1e+5 + 10;
std::multiset<rec> words;
long long costs[MAX_LEN];
long long min_costs[MAX_LEN];
bool operator<(const rec r1, const rec r2) { return r1.str < r2.str; }
int ar[MAX_LEN];
int main() {
  scanf("%d %d %d", &n, &k, &m);
  for (int i = 0; i < n; i++) {
    rec word;
    char *rc = new char[25];
    scanf("%s", rc);
    word.index = i;
    word.str = rc;
    words.insert(word);
  }
  for (int i = 0; i < n; i++) scanf("%lld", costs + i);
  for (int i = 0; i < k; i++) {
    int g;
    scanf("%d", &g);
    long long min_val = 1e+9 + 10000;
    for (int j = 0; j < g; j++) {
      scanf("%d", ar + j);
      ar[j]--;
      min_val = min_val > costs[ar[j]] ? costs[ar[j]] : min_val;
    }
    for (int j = 0; j < g; j++) {
      min_costs[ar[j]] = min_val;
    }
  }
  long long sum = 0;
  rec rr;
  for (int i = 0; i < m; i++) {
    std::cin >> rr.str;
    auto it = words.find(rr);
    if (it != words.end()) {
      sum += min_costs[it->index];
    }
  }
  printf("%lld\n", sum);
  return 0;
}
