


Monodigital representations
Let K be a decimal digit different from 0. We say that an arithmetic expression is a Krepresentation of the integer X if a value of this expression is X and if it contains only numbers composed of a digit K. (All the numbers are of course decimal). The following arithmetical operations are allowed in the expression: addition, subtraction, multiplication and division. Round brackets are allowed too. Division may appear only when a dividend is a multiple of a divisor. ExampleEach of the following expressions is the 5representation of the number 12:
The length of the Krepresentation is the number of occurrences of digit K in the expression. In the example above the first two representations have the length 6, the third  5, and the forth  4. TaskWrite a program which:
InputThe first line of the input file MON.IN contains digit K, K is en element of {1,...,9}. The second line contains number n, 1<=n<=10. In the following n lines there is the series of natural numbers a_{1},...,a_{n}, 1<=a_{i}<=32000 (for i=1,..,n), one number in each line. OutputThe file MON.OUT composes of n lines. The ith line should contain:
ExampleFor the input file MON.IN: 5 2 12 31168 the correct answer is the text file MON.OUT: 4 NIE Your program should look for the file MON.IN in the current directory and produce the output file MON.OUT in current directory too. The file containing source code of your program should have a name MON.???, whereas you should put threeletter abbreviation of used programming language name instead of ???. The same program in executable form should be written in file MON.EXE 