F. Session

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

About the post author Igor Mazurok (5 Posts)

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

Author Info

Igor Mazurok

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

Latest posts by Igor Mazurok (see all)

Leave a Reply