{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"Given a set of digits **S**, and an integer **n**, you have to find how many **n**-digit integers are there, which contain digits that belong to **S** and the difference between any two adjacent digits is not more than two.\n\n"}},{"title":"Input","value":{"format":"MD","content":"Input starts with an integer **T (\u0026#8804; 300)**, denoting the number of test cases.\n\nEach case contains two integers, **m (1 \u0026#8804; m \u0026lt; 10)** and **n (1 \u0026#8804; n \u0026#8804; 10)**. The next line will contain **m** integers **(from 1 to 9)** separated by spaces. These integers form the set **S** as described above. These integers will be distinct and given in ascending order.\n\n"}},{"title":"Output","value":{"format":"MD","content":"For each case, print the case number and the number of valid **n**-digit integers in a single line."}},{"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\u003e3\n3 2\n1 3 6\n3 2\n1 2 3\n3 3\n1 4 6\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1: 5\nCase 2: 9\nCase 3: 9\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"MD","content":"For the first case the valid integers are\n\n1. 11\n2. 13\n3. 31\n4. 33\n5. 66\n\n"}}]}