Arithmetic progression#2897

Arithmetic progression

1 second
256 megabytes
Easy

You need to find an arithmetic progression of natural numbers a_1, a_2, \ldots, a_n with a common difference , such that a_k^2 + 1 is a prime number for every k = 1, 2, \ldots, n. Among all such progressions, choose the one with the greatest number of elements.

The common difference of the progression means that for every k = 2, 3, \ldots, n the equality a_k - a_{k-1} = d holds.

Input

The input consists of several test cases. Each line contains a single integer — the common difference of the progression (1 \leq d \leq 9999). The digit does not appear in the decimal representation of . All numbers in the input are distinct.

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 its first element. Among all progressions with the maximum length, choose the one with the smallest first element.

Examples

Example 1

Loading
Loading