import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); for(int cur = N - 100; cur <= N + 100; cur++){ boolean ok = false; for(int div = 2; div < cur; div++){ if(cur % div == 0){ ok = true; break; } } if(ok){ System.out.println(cur); break; } } } }