import core.stdc.stdlib;
import std.stdio;
import std.range;
import std.algorithm;
import std.array;
import std.string;

bool isPrime(int n)
{
    if (n < 2) return false;
    if (n == 2)
        return true;
    if (n < 1 || (n & 1) == 0)
        return false;
    if (n > 3)
    {
        for (auto i = 3; i * i <= n; i += 2)
        {
            if ((n % i) == 0)
                return false;
        }
    }
    return true;
}

enum maxPrime = 55555;
enum primes = iota(maxPrime).filter!isPrime.array;

auto is5SumPrime(int[] ps) {
    foreach (i0; 0..ps.length-4) {
        foreach (i1; i0+1..ps.length-3) {
            foreach (i2; i1+1..ps.length-2) {
                foreach (i3; i2+1..ps.length-1) {
                    foreach (i4; i3+1..ps.length) {
                        if (isPrime(ps[i0]+ps[i1]+ps[i2]+ps[i3]+ps[i4])) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}

void solve(int[] ps, int last) {
    if (!is5SumPrime(ps)) {
        foreach (i, p; ps) {
            write(p);
            if (i != ps.length - 1) {
                write(" ");
            }
        }
        exit(0);
        return;
    }
    if (last > primes.length-1) return;
    solve(ps[0..$-1] ~ [primes[last]], last+1);
    foreach_reverse (i; 1..ps.length-1) {
        solve(ps[0..i] ~ ps[i+1..$] ~ [primes[last]], last+1);
    }
    solve(ps[1..$] ~ [primes[last]], last+1);
}


void main() {
    int n;
    readf("%d\n", &n);
    int[] ps = primes[0..n];
    solve(ps, n);
}
