// D: Five, Five Everywhere
"use strict";

// if this doesn't work or time is almost up, simply cache
// first 100 prime numbers (from Google) into array and loop
// through until sum is composite

const DEBUG_MODE = false;
const rawInput = DEBUG_MODE
  ? "55"
  : require("fs")
      .readFileSync("/dev/stdin", "utf8")
      .trim();

const isPrime = number => {
  for (let i = 2; i < Math.ceil(Math.sqrt(number)); i++) {
    if (number % i === 0) {
      return false;
    }
  }

  return true;
};

const findNextPrime = number => {
  for (let i = number + 1; ; i++) {
    if (isPrime(i)) {
      return i;
    }
  }
};

const process = inputRaw => {
  const N = parseInt(inputRaw);

  // memoize
  let primeList = [];
  let cumulativeSum = 0;

  for (let i = 0; i < N; i++) {
    const nextPrime = findNextPrime(cumulativeSum === 0 ? 1 : primeList[i - 1]);
    primeList.push(nextPrime);
    cumulativeSum += nextPrime;
  }

  while (isPrime(cumulativeSum)) {
    const lastPrime = primeList.pop();
    const nextPrime = findNextPrime(lastPrime);
    primeList.push(nextPrime);

    cumulativeSum = cumulativeSum - lastPrime + nextPrime;
  }

  console.log(
    primeList.reduce(
      (acc, curr, index) => acc + curr + (index === N - 1 ? "" : " "),
      ""
    )
  );
};

process(rawInput);
