A quadruplet prime number is defined as a set of four prime numbers arranged in the form (a, a + 2, a + 6, a + 8). The largest number in this quadruplet is referred to as the size of the quadruplet prime. For example, the smallest prime quadruplet is (5, 7, 11, 13), and its size is 13. The next largest is (11, 13, 17, 19), which has a size of 19.
Your task is to create a program that determines the maximum size of the quadruplet prime numbers that are less than or equal to a given integer ( n ), where ( n ) falls within the range ( 13 \leq n \leq 10,000,000 ).
Input Format
The input consists of multiple datasets, with each dataset containing a single integer ( n ).
The end of the input is indicated by a single line containing the digit 0.
There can be up to 2000 datasets.
Output Format
For each input dataset, output the maximum prime quadruplet size on a new line.
Example
Input
text
13
14
15
16
17
18
19
20
10000
0
Output
text
13
13
13
13
13
13
19
19
9439
Implementation
Please ensure to place your solution code in the /app/ directory.
Constraints
Ensure that your code can handle the upper limit of input values efficiently.
This format should help clarify the requirements and structure of the problem for participants to follow.
Important: place your implementation at /app/solution.py so the verifier can run it.