Feedback

Time limit1sMemory limit512 MB

Summary
Build a strictly increasing length-N sequence with values at most 1000, second element 2, and last element prime.
Level

Easy3 of 10

Topics
Math, Number theory, Greedy, Implementation
Solved
No attempts yet

Problem

Given NN, find a sequence AA that satisfies the following conditions.

  • The length of AA is NN.
  • For 1≤i≤N−11 \le i \le N-1, Ai<Ai+1A_i < A_{i+1} must hold.
  • 1≤Ai≤1,0001 \le A_i \le 1{,}000 must hold.
  • A2A_2 must be 22.
  • ANA_N must be a prime number.

Input

The first line gives NN.

Output

On the first line, print NN.

On the second line, print A1,A2,…,ANA_1, A_2, \dots, A_N separated by spaces.

Constraints

  • 5≤N≤505 \le N \le 50

Examples1

  1. Example 1

    Input
    5
    
    Expected output
    5
    1 2 8 10 37