#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int maxn = 1e5+5;
const int mod =1e9+7;
typedef pair<int,int>pii;
int a;
int b;
int ans;
int...
#include<bits/stdc++.h>
using namespace std;
map<string,int> ms;
string str;
int arr,temp,mn;
int main()
{
int n,k,m;cin>>n>>k>>m;
for(int i=1;i<=n;i++)cin>>str,ms=i;
for(int i=1;i<=n;i++)cin>>arr,mn=1e9+7;
for(int i=1,j;i<=k;i++)
{
int x;cin>>x;
while(x--)cin>>j,temp=i,mn=min(mn,arr);
}
unsigned long long res=0;
while(cin>>str){res+=mn]];}
return cout<<res<<"n",0;
}
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<set>
using namespace std;
int n,k;
struct node
{
int maxx,minn,sz;
node()
{
int x;sz = 1;
for(int i = 1; i <= k ; i...