import java.util.Scanner; public class N192 { public static void main(String[] args) { Scanner sca = new Scanner(System.in); int N = sca.nextInt(); int A = N - 100; int B = N + 100; for (int i = A; i < B; i++) { for (int k = 2; k < i; k++) { if (i % k == 0) { System.out.println(i); return; } } } } }