Arithmetic progression
You need to find an arithmetic progression of natural numbers ( a_1, a_2, ..., a_n ) with a common difference ( d ), such that ( a_k^2 + 1 ) is a prime number for every ( k = 1, 2, ..., n ). Among all such progressions, select the one with the greatest number of elements.
The common difference ( d ) of the progression implies that for every ( k = 2, 3, ..., n ), the condition ( a_k - a_k-1 = d ) must be satisfied.
Input
The input consists of multiple test cases. Each line contains a single integer ( d ), representing the common difference of the progression (( 1 d 9999 )). The digit ( 0 ) does not appear in the decimal representation of ( d ). All numbers in the input are unique.
Output
For each test case, output a single line with two numbers. The first number is the maximum length of the arithmetic progression. The second number is the smallest possible first element of such a progression. Among all progressions with the maximum length, choose the one with the smallest first element.