import std.algorithm, std.array, std.conv, std.range, std.stdio, std.string;
void main()
{
    auto x = readln.chomp.to!int;
    while (x.notPrime)
        x += 1;
    x.writeln;
}
bool notPrime(int x)
{
    if (x < 4)
        return x < 2;
    int d = 2;
    while (d*d <= x)
    {
        if (!(x % d)) return true;
        d += 1;
    }
    return false;
}
