Simple numbers#2081

Simple numbers

4 seconds
64 megabytes
Very easy

A number is called simple if it can be split into two parts, each containing at least digits (and neither part begins with ), such that both parts are prime numbers. Recall that a prime number is a natural number that has exactly two distinct divisors. You are given a pair of numbers and . Find and output the smallest simple number greater than or equal to .

Input

The input consists of one or more sets of data. Each set is given on a separate line and contains a pair of natural numbers and , separated by a space (1 \leq d \leq 5;\ 1 \leq n \leq 2 \cdot 10^9). There will be no more than sets of input data in the test.

Output

For each set, output the required number on a separate line. It is guaranteed that the answer for any set does not exceed 2 \cdot 10^9.

Examples

Example 1

Loading
Loading