P5723 [Deep Basic 4. Example 13] Prime Pocket

Description

Little A has a prime pocket that can hold prime numbers. Starting from $2$, he checks each natural number in order to see whether it is prime. If it is prime, he puts that number into the pocket. The load of the pocket is the sum of all numbers in the pocket. However, the pocket has a limited capacity: the sum of the primes put in cannot exceed $L$. Given $L$, how many primes can the pocket hold at most? Output these primes from small to large, and then output the maximum number of primes that can be held. Separate numbers with newline characters.

Input Format

One line containing one positive integer $L$.

Output Format

Output these primes from small to large, and then output the maximum number of primes that can be held.

Explanation/Hint

Constraints: $1 \le L \le {10}^5$. Translated by ChatGPT 5