import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n = sc.nextInt(); for (int i = Math.max(3, n-100); i <= n + 100; i++) { for (int j = 2; j*j <= i; j++) { if(i%j==0){ System.out.println(i); return; } } } } }