Problem:
Score: 400 points

Problem Statement

Print a sequence a_1, a_2, ..., a_N whose length is N that satisfies the following conditions:

a_i (1 \leq i \leq N) is a prime number at most 55 555.

The values of a_1, a_2, ..., a_N are all different.

In every choice of five different integers from a_1, a_2, ..., a_N, the sum of those integers is a composite number.

If there are multiple such sequences, printing any of them is accepted.

Notes

An integer N not less than 2 is called a prime number if it cannot be divided evenly by any integers except 1 and N, and called a composite number otherwise.

Constraints

N is an integer between 5 and 55 (inclusive).

Input

Input is given from Standard Input in the following format:

N

Output

Print N numbers a_1, a_2, a_3, ..., a_N in a line, with spaces in between.

Sample Input 1

5

Sample Output 1

3 5 7 11 31

Let us see if this output actually satisfies the conditions.

First, 3, 5, 7, 11 and 31 are all different, and all of them are prime numbers.

The only way to choose five among them is to choose all of them, whose sum is a_1+a_2+a_3+a_4+a_5=57, which is a composite number.

There are also other possible outputs, such as 2 3 5 7 13, 11 13 17 19 31 and 7 11 5 31 3.

Sample Input 2

6

Sample Output 2

2 3 5 7 11 13

2, 3, 5, 7, 11, 13 are all different prime numbers.

2+3+5+7+11=28 is a composite number.

2+3+5+7+13=30 is a composite number.

2+3+5+11+13=34 is a composite number.

2+3+7+11+13=36 is a composite number.

2+5+7+11+13=38 is a composite number.

3+5+7+11+13=39 is a composite number.

Thus, the sequence 2 3 5 7 11 13 satisfies the conditions.

Sample Input 3

8

Sample Output 3

2 5 7 13 19 37 67 79

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace practice1
{
    class Program
    {
        static void Main(string[] args)
        {
            int number = int.Parse(Console.ReadLine());
            int[] a = new int[number];
            int i, j, k, count;

            for (i = 1; i < 5; i++)
            {
                count = 0;

                for (j = 0; j + i <= 55555; j += 5)
                {
                    if (MYCP.PrimeCheck(j + i))
                    {
                        a[count] = j + i;
                        count++;
                        if (count == number)
                        {
                            MYCP.PrintNumbers(a);
                            return;
                        }
                    }
                }
            }
            

        }
    }

    class MYCP
    {
        //標準出力の後改行する
        public static void Println(string str)
        {
            Console.WriteLine(str);
        }

        //標準出力の後改行しない
        public static void Print(string str)
        {
            Console.Write(str);
        }


        //int変数を標準出力する
        public static void PrintNumber(long number)
        {
            Console.WriteLine("" + number);
        }

        //あまり意味はない
        private static string MyScanf()
        {
            return Console.ReadLine();
        }

        //文字列を配列化して返す
        public static string[] MyScanfSplit()
        {
            return MyScanf().Split();
        }


        //double変数をソートする
        public static void MyDoubleSort(double[] boo)
        {
            if (boo.Length < 2) return;

            long i, count;
            double a;

            while (true)
            {
                count = 0;

                for (i = 0; i < boo.Length - 1; i++)
                {
                    if (boo[i] > boo[i + 1])
                    {
                        a = boo[i];
                        boo[i] = boo[i + 1];
                        boo[i + 1] = a;
                        count++;
                    }
                }

                if (count == 0) break;
            }
        }

        //int変数をソートする
        public static void MyIntSort(int[] boo)
        {
            if (boo.Length < 2) return;

            long i, count;
            int a;

            while (true)
            {
                count = 0;

                for (i = 0; i < boo.Length - 1; i++)
                {
                    if (boo[i] > boo[i + 1])
                    {
                        a = boo[i];
                        boo[i] = boo[i + 1];
                        boo[i + 1] = a;
                        count++;
                    }
                }

                if (count == 0) break;
            }
        }

        //int配列の和を返す。
        public static int MyIntSum(int[] a)
        {
            int sum = 0;
            for(int i = 0; i < a.Length; i++)
            {
                sum += a[i];
            }

            return sum;
        }

        //double配列の和を返す。
        public static double MyDoubleSum(double[] a)
        {
            double sum = 0;
            for(int i = 0; i < a.Length; i++)
            {
                sum += a[i];
            }

            return sum;
        }

        //指定された個数分int変数を読み取る
        public static int[] ReadNumbers(long number)
        {
            int[] a = new int[number];
            string[] buff = MyScanfSplit();
            for (long i = 0; i < number; i++)
            {
                a[i] = int.Parse(buff[i]);
            }

            return a;
        }

        //int配列の数字をすべて出力する
        public static void PrintNumbers(int[] a)
        {
            if (a.Length == 0) return;

            Console.Write(a[0]);

            for(int i = 1; i < a.Length; i++)
            {
                Console.Write(" ");
                Console.Write(a[i]);
            }

            Console.WriteLine();
        }

        //渡された自然数が素数か判定する
        public static bool PrimeCheck(int number)
        {
            if (number < 2) return false;

            int a = (int)Math.Sqrt(number);

            for(int i = 2; i <= a; i++)
            {
                if (number % i == 0) return false;
            }

            return true;
        }

        //渡された自然数が累乗数か判定する。累乗数ならtrueを返す。
        public static bool Bekizyousuu_Check(int number)
        {
            if (number == 1) return true;

            int i, copy;


            for (i = 2; i < number; i++)
            {
                copy = number;
                while (copy % i == 0)
                {
                    copy /= i;
                }

                if (copy == 1) return true;
            }

            return false;
        }
    }
}