Little Tuhin is playing with a (4×4) board. And he has a lot of cards numbering from 1 to 7 (inclusive). He can place any card in an unoccupied position in the board. As he is good in math, he places 16 cards in the board in such a way that the summation of the numbers in any row or column or diagonal is equal to a random number N. As he is my younger brother he sometimes wants some help from me. He came to me with his board and all his cards. I saw him quite confused and tired . He said, “I will give you three numbers N, M and P. You have to place the cards as I do. And if you divide the multiplication of all 16 numbers by M, the reminder will not exceed P.” While I was thinking he said, “I want the number of solutions and the first two solutions. If there is only one solution you have to show that one only. Please give me the code. I have to verify myself.” I have an exam tomorrow. So, I can’t help him right now. Can anyone suggest a code? Thanks in advance. Input The input file contains several sets of inputs. Each set contains three integers N, M (0 < M < 100000) andP (0≤P <M)seperatedbyaspace. The input will be terminated by a line where N = M = P = 0. And this line should not be processed. Output For each case in the input, you should first print the set number starting from 1. The second line will contain the number of solutions. If there are more than two solutions then you have to print the first two solutions. If there is one or two soluton(s) just print all of them. The first two solution means the two which are lexicographically smallest (row-wise). Print them in lexicographical order. For any solution first print the numbers in first row, then second row and so on. And after that print a line with 4 dots (‘.’). See the sample input-output for more details. Sample Input 453 395 597 000 Sample Output Set 1: 1 1111 1111 1111 1111 ....

2/2 Set 2: 0 Set 3: 8 1112 1211 2111 1121 .... 1112 2111 1121 1211 ....