HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Unsorted > problem:


Wonder primes

Section problems

• Connected components
• Going to the Movies
• How many digits?
• How many divisors?
• Molecules
• Round numbers
• Tower of Happiness
• Workshop
• Wonder primes
• Arithmetic Operators
• Profits
• Istanbul
• Buying hay
• Sum until 0
• Sum less than N
• Sum of N numbers
• The N Queens Problem

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/2000/2000/2000 ms. Memory limit 65000/65000/65000/65000 Kb.

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