import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

immutable limit = 55555;

void main() {
    int N; scan(N);
    auto primes = eratos(limit + 1);
    auto b = primes.filter!(x => x % 10 == 3).array;
    writefln("%(%s %)", b.take(N).array);
    //writeln(b);
    //writeln(b.length);
}

int[] eratos(int N) {
    auto s = new bool[](N);
    s[] = 1;
    s[0] = s[1] = 0;

    for (int p = 2; p*p < N; p++) {
        if (s[p]) {
            for (int q = p*p; q < N; q += p) {
                s[q] = 0;
            }
        }
    }

    return iota(N).filter!(i => s[i]).array;
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}
