ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Chapter 3. Repetition structures > задача:


12. Wonder primes

Задачи сборника

• 04. Поезд
• 05. Factorial
• 06. X to the power of Y
• 07. Fibonacci Series
• 08. Binary to decimal
• 09. Decimal to binary
• 10. Maximum
• 11. Perfect numbers
• 12. Wonder primes
• 13. Round numbers
• 14. Tower of Happiness
• 2. Molecules
• Степень двойки

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/2000/2000/2000 мс. Лимит памяти 65000/65000/65000/65000 Кб.

Problem description

A wonder primeis a number that can be partitioned into two prime numbers, each of which has at least D digits and, of course, doesn't start with 0. When D=2, the number 11329 is a wonder prime(since it connects 113 and 29, both of which are prime). Your job is to find the first wonder prime greater than or equal to a supplied integer N when you are given D.

Input

There are two integers D and N on the first line (1 ≤ D ≤ 4, 0 < N ≤ 106).

Output

Write first wonder prime according to the description.

Example

stdin stdout

2 11328

11329

Для отправки решений необходимо выполнить вход.

www.contester.ru