import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc=new Scanner(System.in);
        long x=sc.nextLong();
        int[] ary=new int[10000];
        boolean big=false,flag=true;
        ary[0]=2;
        int i=3,j=0;
        for(;i<1000000;i++){
            flag=true;
            if(ary[j]>=x)break;
            for(int k=0;k<=j;k++){
                if(i%ary[k]==0){
                    flag=false;
                    break;
                }
            }
            if(flag){
                j++;
                ary[j]=i;
            }
        }
        System.out.println(ary[j]);
    }
}
/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