#include <bits/stdc++.h>
using namespace std;
int gcd(long long a, int b) {
  if (a < b) {
    return gcd(b, a);
  }
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
class Triplet {
 public:
  long long gcd;
  long long x;
  long long y;
};
Triplet gcdExtendedEuclid(int a, int b) {
  if (b == 0) {
    Triplet myAns;
    myAns.gcd = a;
    myAns.x = 1;
    myAns.y = 0;
    return myAns;
  }
  Triplet smallAns = gcdExtendedEuclid(b, a % b);
  Triplet myAns;
  myAns.gcd = smallAns.gcd;
  myAns.x = smallAns.y;
  myAns.y = (smallAns.x - ((a / b) * (smallAns.y)));
  return myAns;
}
long long modInverse(int A, int M) {
  Triplet ans = gcdExtendedEuclid(A, M);
  return ans.x;
}
bool check(vector<long long>& v1, long long val, long long h) {
  long long ans = 0;
  for (long long i = 0; i < v1.size(); i++) {
    ans += v1[i] / val;
    if (v1[i] % val != 0) {
      ans += 1;
    }
  }
  if (ans > h) {
    return false;
  }
  return true;
}
void multiply(long long A[2][2], long long M[2][2]) {
  long long firstValue = (A[0][0] * M[0][0] + A[0][1] * M[1][0]) % 1000000007;
  long long secondValue = (A[0][0] * M[0][1] + A[0][1] * M[1][1]) % 1000000007;
  long long thirdValue = (A[1][0] * M[0][0] + A[1][1] * M[1][0]) % 1000000007;
  long long fourthValue = (A[1][0] * M[0][1] + A[1][1] * M[1][1]) % 1000000007;
  A[0][0] = firstValue;
  A[0][1] = secondValue;
  A[1][0] = thirdValue;
  A[1][1] = fourthValue;
  return;
}
void getpow(long long A[2][2], long long n) {
  if (n == 0 || n == 1) {
    return;
  }
  getpow(A, n / 2);
  multiply(A, A);
  if (n % 2 != 0) {
    long long first[2][2] = {{1, 1}, {1, 0}};
    multiply(A, first);
  }
  return;
}
long long getpow1(long long n, long long m, long long b) {
  if (m == 0) {
    return 1;
  }
  long long ans = getpow1(n, m / 2, b) % b;
  ans = (ans * ans) % b;
  if (m % 2 != 0) {
    ans = ans * n % b;
  }
  return ans % b;
}
long long getfib(long long n) {
  if (n == 0) {
    return 0;
  }
  long long A[2][2] = {{1, 1}, {1, 0}};
  getpow(A, n);
  long long first[1][2];
  first[0][0] = 0;
  first[0][1] = 1;
  long long ans = first[0][0] * A[0][0] + first[0][1] * A[1][0];
  return ans % 1000000007;
}
vector<long long>* sieve() {
  bool isprime[1000001];
  for (long long i = 0; i < 1000001; i++) {
    isprime[i] = true;
  }
  vector<long long>* primes = new vector<long long>();
  for (long long i = 2; i < 1000001; i++) {
    if (isprime[i] == true) {
      for (long long j = 2 * i; j < 1000001; j += i) {
        isprime[j] = false;
      }
    }
  }
  primes->push_back(2);
  for (long long i = 3; i < 1000001; i++) {
    if (isprime[i] == true) {
      primes->push_back(i);
    }
  }
  return primes;
}
long long getpow2(long long a, string& b, long long m) {
  long long mod = 1000000007;
  long long num = 1;
  for (long long i = b.size() - 1; i >= 0; i--) {
    if (b[i] == 1) {
      num = (num * a) % m;
    } else if (b[i] == 2) {
      num = ((num * a) % m * a) % m;
    }
    a = ((a * a) % m * a) % m;
  }
  return num % m;
}
bool check(long long i, long long m) {
  long long ret = 0;
  i = i / 5;
  while (i) {
    ret += i;
    i = i / 5;
  }
  return (ret == m);
}
long long getcode(string input, long long size, long long arr[]) {
  if (size == 0 || size == 1) {
    return 1;
  }
  if (arr[size] > 0) {
    return arr[size];
  } else {
    long long output = getcode(input, size - 1, arr);
    if ((input[size - 1] - '0') + (input[size - 2] - '0') * 10 <= 26) {
      output += getcode(input, size - 2, arr);
    }
    arr[size] = output;
    return arr[size];
  }
}
long long output[5005];
unsigned long long getcode1(string input, long long size) {
  memset(output, 0, sizeof(output));
  output[0] = 1;
  unsigned long long ans = 0;
  for (long long i = 1; i < size; i++) {
    long long tmp1 = 0;
    long long tmp2 = 0;
    if (input[i] - '0' != 0) {
      tmp1 = 1;
      output[i] = output[i - 1];
    }
    if (((input[i - 1] - '0') * 10 + (input[i] - '0') <= 26) &&
        ((input[i - 1] - '0') * 10 + (input[i] - '0') >= 10)) {
      tmp2 = 1;
      output[i] = (output[i - 2] + output[i]) % 1000000007;
    }
    if (tmp1 == 0 && tmp2 == 0) {
      output[i] = 0;
      ans = 0;
      return ans;
    }
  }
  ans = output[size - 1];
  return ans;
}
long long getans(long long* input, long long n) {
  long long* dp = new long long[n];
  dp[0] = input[0];
  dp[1] = max(input[0], input[1]);
  for (long long i = 2; i < n; i++) {
    dp[i] = max(dp[i - 2] + input[i], dp[i - 1]);
  }
  long long ans = dp[n - 1];
  delete[] dp;
  return ans;
}
long long solve(long long n) {
  if (n == 0) {
    return 0;
  }
  if (n == 1) {
    return 1;
  }
  long long ans1 = max(n / 2, solve(n / 2));
  long long ans2 = max(n / 3, solve(n / 3));
  long long ans3 = max(n / 4, solve(n / 4));
  long long ans = max(n, ans1 + ans2 + ans3);
  return ans;
}
long long mincost(long long input[][501], long long R, long long C) {
  input[R][C] = 1;
  for (long long i = R - 1; i >= 1; i--) {
    input[i][C] = input[i + 1][C] - input[i][C];
    if (input[i][C] <= 0) {
      input[i][C] = 1;
    }
  }
  for (long long i = C - 1; i >= 1; i--) {
    input[R][i] = input[R][i + 1] - input[R][i];
    if (input[R][i] <= 0) {
      input[R][i] = 1;
    }
  }
  for (long long i = R - 1; i >= 1; i--) {
    for (long long j = C - 1; j >= 1; j--) {
      input[i][j] = min(input[i + 1][j], input[i][j + 1]) - input[i][j];
      if (input[i][j] <= 0) {
        input[i][j] = 1;
      }
    }
  }
  return input[1][1];
}
float inputx[105];
float inputy[105];
float f[105];
float dp[105];
bool dp1[105];
map<string, long long> m1;
long long arrx[100001];
string s1[100001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k, m;
  cin >> n >> k >> m;
  for (long long i = 1; i <= n; i++) {
    cin >> s1[i];
  }
  for (long long i = 1; i <= n; i++) {
    cin >> arrx[i];
    m1.insert(pair<string, long long>(s1[i], i));
  }
  for (long long i = 0; i < k; i++) {
    long long num1, num2;
    cin >> num1;
    vector<long long> vnum;
    long long ans = INT_MAX;
    for (long long j = 0; j < num1; j++) {
      cin >> num2;
      vnum.push_back(num2);
      ans = min(arrx[num2], ans);
    }
    for (long long j = 0; j < num1; j++) {
      arrx[vnum[j]] = ans;
    }
  }
  long long cost = 0;
  for (long long i = 0; i < m; i++) {
    string s2;
    cin >> s2;
    long long num = m1[s2];
    cost += arrx[num];
  }
  cout << cost << '\n';
  return 0;
}
