2 sec, 256 M
You are helping your foreign friend on the exam. There is the task:
“You are given a natural number n. Find the minimal natural number k, consisting of the digits a, b and 0 only. It must be a multiplier of n.”
Input. The first string contains a natural number n (1 ≤ n ≤ 1000000). The second one contains two different decimal digits a and b, greater than 0, splitted by a space.
Output. If you can solve this task, output k. Else output “Sorry, I am from ITMO” without quotas.
Idea – Oleg Alexandrovich Petrov
KBIS Software Developer