{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eSpace poker. A legendary game, first version of which was introduced as far as in year 1284 of Alien era. Even nowadays its rules are known only to small group of professional players. Fortunately, the developers of the first program in the world playing space poker asked for your help.\r\n\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThere are \u003ci\u003eN\u003c/i\u003e extraterrestial players in space poker. At the beginning of the round, each player gets \u003ci\u003eM\u003c/i\u003e cards (we call them \u003ci\u003ehole cards\u003c/i\u003e). Players don\u0027t know hole cards of their opponents. Then \u003ci\u003eK\u003c/i\u003e \u003ci\u003ecommunity\u003c/i\u003e cards are consecutively dealt face-up. So, community cards are known to all players. Player\u0027s \u003ci\u003ehand\u003c/i\u003e consists of his hole cards and all community cards\u0026nbsp;— \u003ci\u003eM\u003c/i\u003e\u0026nbsp;+\u0026nbsp;\u003ci\u003eK\u003c/i\u003e cards in total. There are no suits, cards differ only in their values. There are 13 different values: \"2\", \"3\", \"4\", …, \"9\", \"T\", \"J\", \"Q\", \"K\" and \"A\". The card deck is infinite, and the probability of the event that the next card will have a given value is equal to 1/13. The combinations in space poker are represented in the form: \u003cnobr\u003e(\u003ci\u003ev\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e, …, \u003ci\u003ev\u003csub\u003eL\u003c/sub\u003e\u003c/i\u003e)\u003c/nobr\u003e, where \u003ci\u003eL\u003c/i\u003e is the number of different values in the combination. The hand satisfies the combination \u003cnobr\u003e(\u003ci\u003ev\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e, …, \u003ci\u003ev\u003csub\u003eL\u003c/sub\u003e\u003c/i\u003e)\u003c/nobr\u003e in case it contains \u003ci\u003ev\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e cards of one value, \u003ci\u003ev\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e cards of another value, …, \u003ci\u003ev\u003csub\u003eL\u003c/sub\u003e\u003c/i\u003e cards of \u003ci\u003eL\u003c/i\u003e-th value. For example, combination (2,\u0026nbsp;2) is satisfied by hands \"2JA2A\" and \"22233\". Combination (2,\u0026nbsp;3) is satisfied by hand \"KQKQKQ\" but is not satisfied by hand \"AAAAAA\". All combinations have different strength. The winner of the round is a player whose hand satisfies the combination of the maximal strength among all combinations in hands of all players. If there is more than one such player, the round ends in a draw.\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eSuppose you know the hole cards of the first player and partly dealt community cards. Calculate the probability the first player will be the only winner of this round.\r\n\u003c/div\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe first line contains integers \u003ci\u003eN\u003c/i\u003e, \u003ci\u003eM\u003c/i\u003e and \u003ci\u003eK\u003c/i\u003e separated by spaces (\u003cnobr\u003e2 ≤ \u003ci\u003eN\u003c/i\u003e, \u003ci\u003eM\u003c/i\u003e ≤ 10;\u003c/nobr\u003e \u003cnobr\u003e1 ≤ \u003ci\u003eK\u003c/i\u003e ≤ 5\u003c/nobr\u003e). The second line contains \u003ci\u003eM\u003c/i\u003e symbols\u0026nbsp;— hole cards of the first player. The third line contains at most \u003ci\u003eK\u003c/i\u003e symbols\u0026nbsp;— dealt community cards. The fourth line contains integer \u003ci\u003eC\u003c/i\u003e\u0026nbsp;— the number of combinations in space poker \u003cnobr\u003e(1 ≤ \u003ci\u003eC\u003c/i\u003e ≤ 100)\u003c/nobr\u003e. The following \u003ci\u003eC\u003c/i\u003e lines contain combinations in order of increasing strength. Each description has the form \u003cnobr\u003e\u003ci\u003eL\u003c/i\u003e \u003ci\u003ev\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e \u003ci\u003ev\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e … \u003ci\u003ev\u003csub\u003eL\u003c/sub\u003e\u003c/i\u003e\u003c/nobr\u003e. \u003ci\u003eL\u003c/i\u003e and \u003ci\u003ev\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e are positive integers, sum of all \u003ci\u003ev\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e doesn\u0027t exceed \u003ci\u003eM\u003c/i\u003e\u0026nbsp;+\u0026nbsp;\u003ci\u003eK\u003c/i\u003e.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eOutput the probability of winning for the first player with absolute error not exceeding 10\u003csup\u003e−5\u003c/sup\u003e.\r\n\u003c/div\u003e\u003c/div\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2 5 2\r\n23456\r\n\r\n1\r\n1 2\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0.0883526857\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr\u003e\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2 5 2\r\n23456\r\n78\r\n2\r\n7 1 1 1 1 1 1 1\r\n1 4\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0.8407915043\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}