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.

Input | Output |

13
1 2 |
221 |

Idea – Oleg Alexandrovich Petrov

### Igor Mazurok

PhD in Computer Science, Associate professor of Department Applied Mathematics of Odessa I.I.Mechnikov National University, Ukraine

KBIS Software Developer

KBIS Software Developer

#### Latest posts by Igor Mazurok (see all)

- Best of coders - 03/03/2013
- Most popular compiler - 03/03/2013
- Rating software firms - 03/03/2013