#include using namespace std; typedef long long ll; #define F first #define S second #define pii pair #define eb emplace_back #define all(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < n; ++i) #define rep3(i, l, n) for (int i = l; i < n; ++i) #define chmax(a, b) a = max(a, b) #define chmin(a, b) a = min(a, b) #define out(a) cout << a << endl #define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl #define SZ(v) (int)v.size() #define inf (int)(1e9+7) int main() { map mp; int coin[5]; rep(i, 5) { string str; cin >> str; mp[str] = i; cin >> coin[i]; } int n[3]; vector can[3]; rep(i, 3) { cin >> n[i]; rep(j, n[i]) { string str; cin >> str; can[i].eb(str); } } int acc[3][5]; fill_n(*acc, 3 * 5, 0); rep(i, 3) rep(j, n[i]) { acc[i][mp[can[i][j]]]++; } ll sum = 0; rep(i, 5) { ll tmp = 1; rep(j, 3) { tmp *= acc[j][i]; } sum += tmp * 5 * coin[i]; } out(fixed << setprecision(7) << (double)sum / ((ll)n[0] * n[1] * n[2])); rep(i, 5) { ll tmp = 1; rep(j, 3) { tmp *= acc[j][i]; } out(tmp * 5); } }