#include #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) (v).begin(),(v).end() #define int long long using namespace std; //----------------------------------------------------------------------- int cnt[3][5]; signed main() { string str[5]; int coin[5]; REP(i,5){ cin>>str[i]>>coin[i]; } int N[3]; REP(i,3){ cin>>N[i]; REP(j,N[i]){ string s; cin>>s; REP(k,5){ if(s==str[k]) cnt[i][k]++; } } } double ans=0; REP(i,5){ ans+=cnt[0][i]*cnt[1][i]*cnt[2][i]*5*coin[i]; } printf("%.20lf\n",ans/(N[0]*N[1]*N[2])); REP(i,5){ cout<