#include #include #include #include #include using namespace std; int main() { double expectValue = 0; unsigned int coin; string coinName; vector coinNameArray(5); vector coinNumber(5); map coinMap; unsigned int n[3]; string tmpPic; vector> leel; vector> picNumber(3, vector(5)); leel.resize(3); unsigned long long matchPattern[5]={0, 0, 0, 0, 0}; for(int i=0; i<5; ++i) { cin>>coinName>>coin; coinNameArray[i] = coinName; coinNumber[i]=coin; coinMap[coinName] = i; } for (int i = 0; i < 3; ++i) { cin >> n[i]; leel[i].resize(n[i]); for (int j = 0; j < n[i]; ++j) { cin >> tmpPic; picNumber[i][coinMap[tmpPic]]++; leel[i][j]=tmpPic; } } for(int i=0; i<5; ++i) { expectValue += ((picNumber[0][i]/(double)n[0])*(picNumber[1][i]/(double)n[1])*(picNumber[2][i]/(double)n[2])*(double)coinNumber[i]); matchPattern[i] = (unsigned long long)picNumber[0][i]*(unsigned long long)picNumber[1][i]*(unsigned long long)picNumber[2][i]*(unsigned long long)5; } expectValue *= 5.0; cout<