import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto x = lread();
    foreach (i; x .. (x + 10 ^^ 6))
    {
        if (func(i))
        {
            writeln(i);
            return;
        }
    }

}

bool func(long x)
{
    foreach (i; 2 .. x)
    {
        if (x % i == 0)
        {
            return false;
        }
    }
    return true;
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}
