import java.util.Scanner;
import java.util.ArrayList;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    if(x==2){
      System.out.println(2);
    }else{
    ArrayList <Integer> li = new ArrayList <Integer>();
    li.add(2);
    int i = 3;
    int l = 0;
    while(i<1000000){
      for(int j=0;j<li.size();j++){
        if(i%li.get(j)==0){
          l++;
          break;
        }
      }
      if(l==0&&i>=x){
        System.out.println(i);
        break;
      }else if(l==0){
        li.add(i);
      }
    i++;
    l = 0;
   }
    }
  }
}

/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