The arithmetic sequence, in which each of the terms increases by is unusual in two ways: (i) each of the three terms are prime, and, (ii) each of the 4-digit numbers are permutations of one another.
There are no arithmetic sequences made up of three , , or primes, exhibiting this property.
You are given and , find all size sequences where first element is less than and elements are permutations of each other, are prime and are in AP(Arithmetic Progression).
Print the answer as concatenated integer formed by joining terms.
Input contains two integers and
Print the answer corresponding to the test case. each in new line in numerically sorted order of smallest value.