{"problem":{"name":"Poker","description":{"content":"We have $9K$ cards. For each $i = 1, 2, \\dots, 9$, there are $K$ cards with $i$ written on it.   We randomly shuffled these cards and handed out five cards - four face up and one face down - to each o","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc193_d"},"statements":[{"statement_type":"Markdown","content":"We have $9K$ cards. For each $i = 1, 2, \\dots, 9$, there are $K$ cards with $i$ written on it.  \nWe randomly shuffled these cards and handed out five cards - four face up and one face down - to each of Takahashi and Aoki.  \nYou are given a string $S$ representing the cards handed out to Takahashi and a string $T$ representing the cards handed out to Aoki.  \n$S$ and $T$ are strings of five characters each. Each of the first four characters of each string is `1`, `2`, $\\dots$, or `9`, representing the number written on the face-up card. The last character of each string is `#`, representing that the card is face down.  \nLet us define the score of a five-card hand as $\\displaystyle \\sum_{i=1}^9 i \\times 10^{c_i}$, where $c_i$ is the number of cards with $i$ written on them.  \nTakahashi wins when the score of Takahashi's hand is higher than that of Aoki's hand.  \nFind the probability that Takahashi wins.\n\n## Constraints\n\n*   $2 ≤ K ≤ 10^5$\n*   $|S| = |T| = 5$\n*   The first through fourth characters of each of $S$ and $T$ are `1`, `2`, $\\dots$, or `9`.\n*   Each of the digit `1`, `2`, $\\dots$, and `9` appears at most $K$ times in total in $S$ and $T$.\n*   The fifth character of each of $S$ and $T$ is `#`.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$K$\n$S$\n$T$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc193_d","tags":[],"sample_group":[["2\n1144#\n2233#","0.4444444444444444\n\nFor example, if Takahashi's hand is `11449` and Aoki's hand is `22338`, Takahashi's score is $100+2+3+400+5+6+7+8+90=621$ and Aoki's score is $1+200+300+4+5+6+7+80+9=612$, resulting in Takahashi's win.  \nTakahashi wins when the number on his face-down card is greater than that of Aoki's face-down card, so Takahashi will win with probability $\\frac49$."],["2\n9988#\n1122#","1.0"],["6\n1122#\n2228#","0.001932367149758454\n\nTakahashi wins only when Takahashi's hand is `11222` and Aoki's hand is `22281`, with probability $\\frac2{1035}$."],["100000\n3226#\n3597#","0.6296297942426154"]],"created_at":"2026-03-03 11:01:14"}}