{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"Double Patience is a single player game played with a standard 36-card deck. The cards are shuffled and laid down on a table in 9 piles of 4 cards each, faces up. \r\u003cbr\u003e\r\u003cbr\u003eAfter the cards are laid down, the player makes turns. In a turn he can take top cards of the same rank from any two piles and remove them. If there are several possibilities, the player can choose any one. If all the cards are removed from the table, the player wins the game, if some cards are still on the table and there are no valid moves, the player loses. \r\u003cbr\u003e\r\u003cbr\u003eGeorge enjoys playing this patience. But when there are several possibilities to remove two cards, he doesn\u0027t know which one to choose. George doesn\u0027t want to think much, so in such case he just chooses a random pair from among the possible variants and removes it. George chooses among all possible pairswith equal probability. \r\u003cbr\u003e\r\u003cbr\u003eFor example, if the top cards are KS, KH, KD, 9H, 8S, 8D, 7C, 7D, and 6H, he removes any particular pair of (KS, KH), (KS, KD), (KH, KD), (8S, 8D), and (7C, 7D) with the equal probability of 1/5. \r\u003cbr\u003e\r\u003cbr\u003eOnce George\u0027s friend Andrew came to see him and noticed that he sometimes doesn\u0027t act optimally. George argued, that it is not important - the probability of winning any given patience with his strategyis large enough. \r\u003cbr\u003e\r\u003cbr\u003eHelp George to prove his statement - given the cards on the table in the beginning of the game, find out what is the probability of George winning the game if he acts as described. \r\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input contains nine lines. Each line contains the description of four cards that form a pile in the beginning of the game, from the bottom card to the top one. \r\u003cbr\u003e\r\u003cbr\u003eEach card is described with two characters: one for rank, one for suit. Ranks are denoted as \u00276\u0027 for six, \u00277\u0027 for seven, \u00278\u0027 for eight, \u00279\u0027 for nine, \u0027T\u0027 for ten, \u0027J\u0027 for jack, \u0027Q\u0027 for queen, \u0027K\u0027 for king, and \u0027A\u0027 for ace. \r\u003cbr\u003e\r\u003cbr\u003eSuits are denoted as \u0027S\u0027 for spades, \u0027C\u0027 for clubs, \u0027D\u0027 for diamonds, and \u0027H\u0027 for hearts. For example, \"KS\" denotes the king of spades. \r\u003cbr\u003e\r\u003cbr\u003eCard descriptions are separated from each other by one space. \r\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"Output one real number - the probability that George wins the game if he plays randomly. Your answer must be accurate up to 10\u003csup\u003e-6\u003c/sup\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\u003eAS 9S 6C KS\r\nJC QH AC KH\r\n7S QD JD KD\r\nQS TS JS 9H\r\n6D TD AD 8S\r\nQC TH KC 8D\r\n8C 9D TC 7C\r\n9C 7H JH 7D\r\n8H 6S AH 6H\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0.589314\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}