Shut the Box is a dice game played with a row of cards, each labelled with a distinct positive integer. Every card is either open (face up) or shut (face down). On each turn you roll dice and read their total; you must then shut some set of currently open cards whose values add up to exactly that total. If no such set exists, your turn ends and the box is not shut. You win when every card has been shut ("the box is shut").
There is a twist in the dice rule. Normally two fair dice are rolled, so all 36 ordered outcomes are equally likely and the total runs from 2 to 12. But whenever the total value of the still-open cards is 6 or less, a single fair die is rolled instead (total 1 to 6, each with probability $1/6$).
Dr. Banner keeps losing at Shut the Box and is about to lose his temper. To calm him, you must give him the best move: given the open cards and the total he has just rolled, choose the set of open cards to shut that maximizes the probability of eventually shutting the box under optimal future play. You must also report that probability.
For example, suppose the open cards are 1, 2, and 3 and the rolled total is 3. Two moves are possible:
The second move is better, so it is the answer.
The first line contains the number of test cases $T$ ($T < 100$). Each of the next $T$ lines describes one test case: the rolled total (the target), then the number of open cards $n$, then the $n$ open card values in ascending order, all separated by spaces.
For each test case, print one line.
The best move is: <cards>, and probability of shutting = <p> where <cards> are the shut card values in ascending order separated by single spaces, and <p> is the probability of eventually shutting the box after that move. Print the probability rounded to four decimal places, except print exactly 1 when the move shuts every remaining card (probability 1).No move found.When several moves reach the same maximum probability, choose the one whose ascending list of shut cards is lexicographically smallest.