Professional Documents
Culture Documents
Smallest Multiple in Permuted Digits: Input
Smallest Multiple in Permuted Digits: Input
Output
Constraints
1≤N≤1000000000000
1≤d≤1000000
Example 1
Input
210
Output
12
Example 2
Input
1707693158
853684
Output
513917768
Example 3
Input
531
Output
-1
Input Format: The first line of the input is the number of rows (depth) Galois
used in his coding scheme The next line is the encoded message
Output Format: The decoded message with all the padding characters (if any)
removed.