#include using namespace std; int main(){ map a,b,c; vector > des; long long n1,n2,n3,in; double ans=0; vector v; string s; for(int i=0;i<5;i++){cin >> s >> in;des.push_back(make_pair(s,in));} cin >> n1;for(int i=0;i> s;a[s]++;} cin >> n2;for(int i=0;i> s;b[s]++;} cin >> n3;for(int i=0;i> s;c[s]++;} for(vector >::iterator iter=des.begin();iter!=des.end();iter++){ v.push_back(a[iter->first]*b[iter->first]*c[iter->first]*5); ans+=v.back()*iter->second; } printf("%f\n",ans/(n1*n2*n3)); for(vector::iterator iter=v.begin();iter!=v.end();iter++) cout << *iter << endl; return 0; }