eolymp
bolt
Try our new interface for solving problems
Problems

Progress in the artillery does not stop

Progress in the artillery does not stop

The General Petrenko interested in the question: What is the greatest integer \textbf{N} multiple of \textbf{M}, can be displayed on the device constructed using the \textbf{K} light-emitting diodes? The number of light-emitting diodes needed to display each of the figures shown. \includegraphics{https://static.e-olymp.com/content/4d/4d37100b8f460a8cd42dfc83df5ab836b073b01d.jpg} \InputFile In one line given two integers \textbf{K} and \textbf{M} through the gap (\textbf{1} ≤ \textbf{K} ≤ \textbf{100}, \textbf{1} ≤ \textbf{M} ≤ \textbf{3000}). \OutputFile Remove only the number \textbf{N} - the answer to the general question. If the solution does not exist, output a \textbf{-1}.
Time limit 2 seconds
Memory limit 64 MiB
Input example #1
6 3
Output example #1
111
Source Stage III All-Ukrainian Olympiad 2009-2010 Zhitomir