Company: Nike_26nov
Difficulty: medium
The Digital Vault - Unlock the Secret Code An ancient digital vault opens only when you type a valid unlock code . Every key on its keypad is broken except two digit keys, digit1 and digit2 , so the code you type may use those two digits and nothing else. A key number K is engraved on the vault door. A code is accepted when all of the following hold: it is an integer strictly greater than K ; it is divisible by K , that is code % K == 0 ; every one of its digits is digit1 or digit2 — it does not have to use both; it is written without a leading zero; it fits in a 32-bit signed integer, so code <= 2147483647 . Print the smallest accepted code, or -1 when no code satisfies all of the conditions. Input Format A single line with three space-separated integers K , digit1 and digit2 . Output Format Print a single integer — the smallest valid unlock code, or -1 if none exists. Constraints 1 <= K <= 10^9 0 <= digit1 <= 9 0 <= digit2 <= 9 digit1 and digit2 may be equal, in