void main()
{
    long x = rdElem;

    long limit = 200000;
    auto sieve = new Prime(limit);
    foreach (i; x .. limit)
    {
        if (sieve.isPrime(i))
        {
            i.writeln;
            return;
        }
    }
}

struct Prime
{
    bool[] flags;

    this(long limit)
    {
        flags = makeSieve(limit);
    }

    bool[] makeSieve(long limit)
    {
        long len = (limit - 1) / 2;
        bool[] result = new bool[len];
        result[] = true;
        foreach (i; 0 .. len)
        {
            if (!result[i]) continue;

            long prime = 3 + 2 * i;
            foreach (j; iota(prime+i, len, prime))
            {
                result[j] = false;
            }
        }
        return result;
    }

    bool isPrime(long number)
    in
    {
        assert((number - 1) / 2 <= flags.length);
    }
    body
    {
        if (number < 2)
            return false;
        else if (number == 2)
            return true;
        else if (number % 2 == 0)
            return false;
        else
            return flags[(number-3)/2];
    }
}

T rdElem(T = long)()
{
    //import std.stdio : readln;
    //import std.string : chomp;
    //import std.conv : to;

    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;

dchar[] rdDchar()
{
    //import std.conv : to;

    return rdStr.to!(dchar[]);
}

T[] rdRow(T = long)()
{
    //import std.stdio : readln;
    //import std.array : split;
    //import std.conv : to;

    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdRow!T).array;
}

void wrMat(T = long)(T[][] mat)
{
    //import std.stdio : write, writeln;

    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;