"use strict";
var INPUT = require('fs').readFileSync('/dev/stdin', 'utf-8');
function isPrime(x) {
    for (var i = Math.floor(x / 2); i >= Math.sqrt(x); i--) {
        if (x % i === 0) {
            return false;
        }
    }
    return true;
}
var X = Number(INPUT.trim());
var x = X;
while (true) {
    if (isPrime(x)) {
        console.log(x);
        break;
    }
    x++;
}
