// 🐋💭 Next Prime
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}



func main() {
    var x = readInt()
    var count = 0
    var isNotPrime = true
    
    while isNotPrime {
        for i in 1..<x {
            count += x % i == 0 ? 1: 0
            if count > 1 {
                break
            }
            
        }
        if count > 1 {
            count = 0
            x += 1
        } else {
            isNotPrime = false
        }
        
    }
    print(x)
}
main()
