import java.util.ArrayList;
import java.util.Scanner;

// 20
public class Main {
    static int getMorePrime(int n) {
        if(n == 2) return n;

        ArrayList<Integer> primes = new ArrayList<Integer>();
        primes.add(2);
        int i = 2;
        while(true) {
            for(int j = 0 ; j < primes.size(); j++)
                if(i % primes.get(j) == 0) {
                    ++i;
                    j = 0;
                }
            if(i >= n) return i;
            primes.add(i);
            ++i;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        System.out.println(getMorePrime(n));
    }

}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz