#include #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) for(int i = (n) - 1; (i) >= 0; --i) #define SZ(n) (int)(n).size() #define ALL(n) (n).begin(), (n).end() #define MOD LL(1e9 + 7) #define INF 1000000 using namespace std; typedef long long LL; typedef vector VI; typedef pair PI; int main() { string s[5]; int coin[5] = {}; REP(i, 5) cin >> s[i] >> coin[i]; int n[3]; map mpa, mpb, mpc; REP(i, 3) { cin >> n[i]; REP(j, n[i]) { string st; cin >> st; if (i == 0) mpa[st]++; if (i == 1) mpb[st]++; if (i == 2) mpc[st]++; } } double ans = 0; LL u[5] = {}; REP(i, 5) { u[i] = 1LL * mpa[s[i]] * mpb[s[i]] * mpc[s[i]] * 5; ans += u[i] * coin[i]; } REP(i, 3) ans /= (double)n[i]; cout << ans << endl; cout << u[0] << endl; cout << u[1] << endl; cout << u[2] << endl; cout << u[3] << endl; cout << u[4] << endl; return 0; }