import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); int n = Integer.parseInt(line); int min = n - 100; if (min < 3) { min = 3; } int max = n + 100; if (n % 2 == 0) { System.out.println(n); return; } for (int i = min; i < max; i ++) { for (int j = 2; j < i; j+=2) { if (i % j == 0) { System.out.println(i); return; } } } } }