//include //------------------------------------------ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; //input //------------------------------------------ #define re(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__); template void MACRO_VAR_Scan(T& t) { cin >> t; } templatevoid MACRO_VAR_Scan(First& first, Rest&...rest) { cin >> first; MACRO_VAR_Scan(rest...); } #define rv_row(type, n, ...)vector __VA_ARGS__;MACRO_VEC_ROW_Init(n, __VA_ARGS__); for(int i=0; i void MACRO_VEC_ROW_Init(int n, T& t) { t.resize(n); } templatevoid MACRO_VEC_ROW_Init(int n, First& first, Rest&...rest) { first.resize(n); MACRO_VEC_ROW_Init(n, rest...); } template void MACRO_VEC_ROW_Scan(int p, T& t) { cin >> t[p]; } templatevoid MACRO_VEC_ROW_Scan(int p, First& first, Rest&...rest) { cin >> first[p]; MACRO_VEC_ROW_Scan(p, rest...); } #define rv(type, c, n) vector c(n);for(auto& i:c)cin>>i; #define rMAT(type, c, n, m) vector> c(n, vector(m));for(auto& r:c)for(auto& i:r)cin>>i; void _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } // output //------------------------------------------ #define pr(x) cout<> v;return v; } template inline string toString(T x) { ostringstream sout;sout << x;return sout.str(); } //math //------------------------------------------ template inline T sqr(T x) { return x*x; } templateinline void chmin(A &a, B b) { if (a>b)a = b; } templateinline void chmax(A &a, B b) { if (a>= 1);return ans; } ll qpmod(ll a, ll b, ll mo) { ll ans = 1ll;do { if (b & 1)ans = 1ll * ans*a%mo;a = 1ll * a*a%mo; } while (b >>= 1);return ans; } inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } inline bool valid(int x, int h) { return 0 <= x && x < h; } //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define EXISTST(s,c) (((s).find(c)) != std::string::npos) #define SORT(c) sort((c).begin(),(c).end()) #define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end()) #define POSL(x,val) (lower_bound(x.begin(),x.end(),val)-x.begin()) #define POSU(x,val) (upper_bound(x.begin(),x.end(),val)-x.begin()) #define X first #define Y second #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMINF(a) memset(a,0x3f,sizeof(a))//1e9<1061109567=a;i--) #define rrepll(i,a,b) for(long long i=(b)-1ll;i>=a;i--) #define fo(x,c) for(auto &x : c) #define repeat(i,a,b) for(int i=(a);i<=(b);++i) //typedef //------------------------------------------ typedef vector vi; typedef vector vii; typedef vector vll; typedef vector vs; typedef pair P; typedef pair Pll; typedef pair, int> PT; typedef vector> vpii; //constant //------------------------------------------ const double EPS = 1e-8; const double PI = acos(-1.0); const int INF = (int)(1e9) + 7; const ll MOD = (ll)(1e9) + 7; const ll MOD2 = (ll)(1e18) + 9; #define ADD(a, b) a = (a + ll(b)) % MOD #define MUL(a, b) a = (a * ll(b)) % MOD const ll INF2 = (ll)(1e18); const ll INTMAX = (0x7FFFFFFFL); const ll LLMAX = (0x7FFFFFFFFFFFFFFFL); const int N4 = (int)1e4 + 10; const int N5 = (int)1e5 + 10; const int N9 = (int)1e9; int dx[8] = { 1, 0, -1, 0 , 1, -1, -1, 1 }; int dy[8] = { 0, 1, 0, -1, -1, -1, 1, 1 }; //------------------------------------------ ll ans, cnt, ret, cur, sum, f; ll n[3]; void _main() { map ma; vs ss(5); vll cc(5); rep(i, 5) { cin >> ss[i] >> cc[i]; ma[ss[i]] = cc[i]; } vector> v(3); rep(i, 3) { cin >> n[i]; rv(string, u, n[i]); fo(x, u)v[i][x]++; } vll answer(5); rep(i, 5) { answer[i] = 5; rep(j, 3)answer[i] *= v[j][ss[i]]; } double d = 0.0; rep(i, 5) { d += double(answer[i] * cc[i]) / double(n[0] * n[1] * n[2]); } cout << d << endl; rep(i, 5)cout << answer[i] << endl; }