using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { string[] names = new string[5]; decimal totalCase = 0; for (int i = 0; i < 5; i++) { string[] inpt = Reader.ReadLine().Split(' '); int s = int.Parse(inpt[1]); Score.Add(inpt[0], s); names[i] = inpt[0]; } int realLen = int.Parse(Reader.ReadLine()); totalCase = realLen; for (int i = 0; i < realLen; i++) { string inpt = Reader.ReadLine(); if(Real1.ContainsKey(inpt)) { Real1[inpt]++; } else { Real1[inpt] = 1; } } realLen = int.Parse(Reader.ReadLine()); totalCase *= realLen; for (int i = 0; i < realLen; i++) { string inpt = Reader.ReadLine(); if (Real2.ContainsKey(inpt)) { Real2[inpt]++; } else { Real2[inpt] = 1; } } realLen = int.Parse(Reader.ReadLine()); totalCase *= realLen; for (int i = 0; i < realLen; i++) { string inpt = Reader.ReadLine(); if (Real3.ContainsKey(inpt)) { Real3[inpt]++; } else { Real3[inpt] = 1; } } decimal totalPoint = 0; StringBuilder ans = new StringBuilder(); foreach (string n in names) { decimal point = 0; if(Real1.ContainsKey(n)) { point = Real1[n]; } if(Real2.ContainsKey(n)) { point *= Real2[n]; } else { point = 0; } if(Real3.ContainsKey(n)) { point *= Real3[n]; } else { point = 0; } point *= 5; totalPoint += (point * Score[n]); ans.AppendLine(((long)point).ToString()); } Console.WriteLine(totalPoint / totalCase); Console.Write(ans.ToString()); } private Dictionary Real1 = new Dictionary(); private Dictionary Real2 = new Dictionary(); private Dictionary Real3 = new Dictionary(); private Dictionary Score = new Dictionary(); public class Reader { static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" Bell 5 star 10 heart 20 spade 50 diamond 100 6 Bell diamond star spade star Bell 6 Bell heart star Bell heart diamond 6 spade heart spade star Bell diamond "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }