Progress in the artillery does not stop
Medium
Execution time limit is 2 seconds
Runtime memory usage limit is 64 megabytes
The General Petrenko interested in the question: What is the greatest integer N multiple of M, can be displayed on the device constructed using the K light-emitting diodes? The number of light-emitting diodes needed to display each of the figures shown.
Input
In one line given two integers K and M through the gap (1 ≤ K ≤ 100, 1 ≤ M ≤ 3000).
Output
Remove only the number N - the answer to the general question. If the solution does not exist, output a -1.
Examples
Input #1
Answer #1
Submissions 813
Acceptance rate 15%