{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n div.illustration {\n float: right;\n padding-left: 20px;\n }\n div.illustration .illustration {\n width: 100%;\n border-radius: 4px;\n }\n pre {\n display: block;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cp\u003eThe impossible has happened. Bear G. has fallen into his own\n trap. Lured by a delicious box of Domaćica, without even\n thinking, he rushed and fell into his trap. In order to get out\n of the trap, he must solve the following task with your help.\n You are given three integers \u003cspan class\u003d\"tex2jax_process\"\u003e$L$\u003c/span\u003e, \u003cspan class\u003d\"tex2jax_process\"\u003e$D$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$X$\u003c/span\u003e.\u003c/p\u003e\n\n \u003cul class\u003d\"itemize\"\u003e\n \u003cli\u003e\n \u003cp\u003edetermine the minimal integer \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e such that \u003cspan class\u003d\"tex2jax_process\"\u003e$L \\leq N \\leq D$\u003c/span\u003e and the sum of\n its digits is \u003cspan class\u003d\"tex2jax_process\"\u003e$X$\u003c/span\u003e\u003c/p\u003e\n \u003c/li\u003e\n\n \u003cli\u003e\n \u003cp\u003edetermine the maximal integer \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e such that \u003cspan class\u003d\"tex2jax_process\"\u003e$L \\leq M \\leq D$\u003c/span\u003e and the sum of\n its digits is \u003cspan class\u003d\"tex2jax_process\"\u003e$X$\u003c/span\u003e\u003c/p\u003e\n \u003c/li\u003e\n \u003c/ul\u003e\n\n \u003cp\u003eBear will be able to escape from the trap if he correctly\n determines numbers \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e and\n \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e. The numbers\n \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e will always exist.\u003c/p\u003e\n\n \u003ch2\u003eInput\u003c/h2\u003e\n\n \u003cp\u003eThe first line of input contains the integer \u003cspan class\u003d\"tex2jax_process\"\u003e$L$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1\n \\leq L \\leq 10\\, 000$\u003c/span\u003e), the number from the task. The\n second line of input contains the integer \u003cspan class\u003d\"tex2jax_process\"\u003e$D$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1\n \\leq D \\leq 10\\, 000$\u003c/span\u003e, \u003cspan class\u003d\"tex2jax_process\"\u003e$L\n \\leq D$\u003c/span\u003e), the number from the task. The third line of\n input contains the integer \u003cspan class\u003d\"tex2jax_process\"\u003e$X$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1\n \\leq X \\leq 36$\u003c/span\u003e), the number from the task.\u003c/p\u003e\n\n \u003ch2\u003eOutput\u003c/h2\u003e\n\n \u003cp\u003eThe first line of output must contain the integer\n \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e from the task. The\n second line of output must contain the integer \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e from the task.\u003c/p\u003e\n\n \u003ch2\u003eSample 1\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\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\u003e1\n100\n4\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n40\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n\n \u003ch2\u003eSample 2\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\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\u003e100\n500\n12\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e129\n480\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n\n \u003ch2\u003eSample 3\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\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\u003e1\n10000\n1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n10000\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n "}}]}