Задача B для тренировки в сентябре
Первоисточник: ACM ICPC 2009-2010, NEERC, Northern Subregional Contest St Petersburg, October 17, 2009
Задачу добавил: elena
Успешно сдано решений: 7Problem D. Dragon's Question
Time limit: 3 seconds
Memory limit: 256 megabytes
In a land far-away there lives a noble man, and he has three sons. The elder of them is very clever, his especial strength is calculation: he can easily count a determinant of fifth degree in his mind without paper and pencil. The middle brother is also very talented, he is particularly strong in theoretic questions.
But the younger brother has absolutely no talent in mathematics. One day they went for a walk. Suddenly a wind started to blow and something closed the sun from them: it was a hungry dragon, returning to his lair from unsuccessful hunt.
"Hey, boys. I will give you a problem, and if you do not solve it, nothing will save you!" - said the dragon.
The elder brothers smiled ironically. Of course, they were so clever that no dragon could ask them a question they were not able to answer.
"Give me a positive integer number which is divisible by d and has exactly n digits in it, assuming that d is equal to forty-five and n is equal to three!" - was the dragon's question.
"One hundred and thirty-five." - answered the elder brother.
"Good, go where you want. But I will return and ask you a similar question in a year." - said the upset hungry dragon and flew away.
A year passed, and the elder brother got married and left his parents' home. Two younger brothers went for a walk discussing this event, and met the dragon again.
"Hey boys, give me a positive integer number which is divisible by twenty three and has exactly one digit in it" - asked the dragon.
"No solution" - answered the middle brother.
"You are still too clever, go where you want. But I will return and ask you a similar question." - said the dragon and flew away.
Another year passed and the middle brother got married and left his parents' home. The younger brother now does not go outside, because he does not have enough knowledge to answer the dragon's questions.
Please, help him and write a program - the boy is very afraid.
The input file contains the only line with numbers n and d (1 <= n <= 1000; 1 <= d <= 1 000 000).
The first and only line of the output file must contain the answer to be given to the dragon - either a n-digit number (without leading zeroes) divisible by d or a string "No solution".