Tianjin University Online Judge
ProblemsSubmitRuns StatusRank ListStatisticsClarifications

G.   Wonderprime Brands

Time Limit: 1.0 Seconds   Memory Limit: 65536K    Multiple test files



The cows are forever competing to see who has the best brand. The latest rage is brands that are 'Wonderprimes'. You probably already know that a brand consists of a sequence of digits that does not begin with 0; brands actually look a lot like positive integers.

A wonderprime is 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 wonderprime (since it connects 113 and 29, both of which are prime).

Only a few of the cows have wonderprime brands, but they all want one. Your job is to find the first wonderprime greater than or equal to a supplied integer N (1 ≤ N ≤ 2,000,000,000). No integer greater than 2,000,000,000 will be required.

Input

* Line 1: Two space-separated integers: D and N

Output

* Line 1: A line that contains the first wonderprime no smaller than N.

Sample Input

2 11328

Sample Output

11329



Source:  USACO 2006 December Competition

Problem ID in problemset: 2837



Submit   Back   Runs   Statistics   Clarifications

Tianjin University Online Judge v1.2.4