Problem:
Score : 600 points

Problem Statement

Nagase is a top student in high school. One day, she's analyzing some properties of special sets of positive integers.

She thinks that a set S = \{a_{1}, a_{2}, ..., a_{N}\} of distinct positive integers is called special if for all 1 \leq i \leq N, the gcd (greatest common divisor) of a_{i} and the sum of the remaining elements of S is not 1.

Nagase wants to find a special set of size N. However, this task is too easy, so she decided to ramp up the difficulty. Nagase challenges you to find a special set of size N such that the gcd of all elements are 1 and the elements of the set does not exceed 30000.

Constraints

3 \leq N \leq 20000

Input

Input is given from Standard Input in the following format:

N

Output

Output N space-separated integers, denoting the elements of the set S. S must satisfy the following conditions :

The elements must be distinct positive integers not exceeding 30000.

The gcd of all elements of S is 1, i.e. there does not exist an integer d > 1 that divides all elements of S.

S is a special set.

If there are multiple solutions, you may output any of them. The elements of S may be printed in any order. It is guaranteed that at least one solution exist under the given contraints.

Sample Input 1

3

Sample Output 1

2 5 63

\{2, 5, 63\} is special because gcd(2, 5 + 63) = 2, gcd(5, 2 + 63) = 5, gcd(63, 2 + 5) = 7. Also, gcd(2, 5, 63) = 1. Thus, this set satisfies all the criteria.

Note that \{2, 4, 6\} is not a valid solution because gcd(2, 4, 6) = 2 > 1.

Sample Input 2

4

Sample Output 2

2 5 20 63

\{2, 5, 20, 63\} is special because gcd(2, 5 + 20 + 63) = 2, gcd(5, 2 + 20 + 63) = 5, gcd(20, 2 + 5 + 63) = 10, gcd(63, 2 + 5 + 20) = 9. Also, gcd(2, 5, 20, 63) = 1. Thus, this set satisfies all the criteria.

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}



const int SIZE = 1000000;
vector<int> primes;
bool isPrime[SIZE];

void make_primes() {
  if (primes.size() > 0) return;
  memset(isPrime, true, sizeof(isPrime));
  isPrime[0] = isPrime[1] = false;
  for (int i = 2; i * i < SIZE; i++) 
    if (isPrime[i])
      for (int j = i * i; j < SIZE; j += i)
        isPrime[j] = false;
  REP(i, SIZE) if (isPrime[i]) primes.push_back(i);
}


ll gcd(ll a, ll b) {
  return b == 0 ? a : gcd(b, a%b);
}


int nextInt() { int x; scanf("%d", &x); return x;}

vector<int> solve(int N) {

  const int MAX_N = 30000;
  bool vis[MAX_N + 1] = {};
  int K = 0;

  ll pp = 1;
  for (int i = 2; i <= MAX_N; i++) {
    if (isPrime[i]) {
      pp *= i;
      vis[i] = true;
      K++;
      for (int j = i + i; j <= MAX_N; j += i) {
        if (!vis[j]) K++;
        vis[j] = true;
      }
      if (i >= 3 && K >= N) {
        set<int> ansSet;
        vector<int> ans;
        for (int i = 0; (int)ans.size() < N - 1; i++) {
          if (vis[i]) {
            ans.push_back(i);
            ansSet.insert(i);
          }
        }
        ll As = 0;
        REP(i, ans.size()) As += ans[i];
        int last = 2;
        while (last <= 30000) {
          if (ansSet.count(last) == 0 && (last + As) % pp == 0 && gcd(As, last) != 1)
            break;
          last++;
        }
        if (last > 30000) {
          ans.push_back(999999);
        } else {
          ans.push_back(last);
          return ans;
        }
      }
    }
  }
  return vector<int>();
}

bool check(vector<int> v, int N) {
  if ((int)v.size() != N) {
    cout << "size " << N << " " << v.size() << endl;
    return false;
  } 
  set<int> st;
  for (auto x : v) {
    
    if (x > 30000) {
      cout << "over 30000" << endl;
      return false;
    }
  }
  for (auto x : v) st.insert(x);
  if (st.size() != v.size()) {
    cout << "not uniq." << endl;
    return false;
  }
  
  ll S = 0;
  for (auto x : v) S += x;
  for (auto x : v) {
    if (gcd(x, (int)(S - x)) == 1) {
      cout << "gcd " << x << " " << (S-x) << " is " << gcd(x, (S-x)) << endl;
      return false;
    }
  }
  return true;
}

int main2(int N) {
  
  vector<int> ans = solve(N);  

  // if (!check(ans, N)) {
  //   cout << "Wrong:" << N << endl;
  //   pv(ALL(ans));
  //   exit(1);
  // }


  REP(i, N) {
    if (i > 0) cout << " ";
    cout << ans[i];
  }
  cout << endl;
  
  return 0;
}

int main() {
  make_primes();
  // int p = 0, np = 0;
  // for (int i = 2; i <= 30000; i++) {
    // if (isPrime[i]) p++; else np++;
  // }
  // cout << p << "  " << np << endl;
  // for (;!cin.eof();cin>>ws)
    main2(nextInt());
  // for (int i = 3; i <= 20000; i++) { cout << i << endl; main2(i); }
  return 0;
}