Simple numbers
A number is termed "simple" if it can be divided into two segments, each containing at least d digits (with neither segment beginning with 0), such that both segments are prime numbers. Recall that prime numbers are natural numbers with exactly two distinct divisors. You are provided with a pair of numbers d and n. Your task is to find and output the smallest simple number that is not less than n.
Input
The input consists of one or more sets of data. Each set is presented on a separate line and contains a pair of natural numbers d and n, separated by a space (1 ≤ d ≤ 5; 1 ≤ n ≤ 2·10^9). There will be no more than 5 sets of input data in the test.
Output
For each set, output the required number on a separate line. It is guaranteed that the solution for any set will not exceed 2·10^9.