package Yukicoder /** * Created by hichikawa on 2015/11/11. */ fun main(args: Array) { fun readLineLong() : Long { val str = readLine() as String return str.toLong() } val num = readLineLong() if (num != 2.toLong() && num % 2.toLong() == 0.toLong()) { println(num) return } val min = Math.max(4, num - 100) for (i in min..(num+100)) { if (i.toInt() % 2 == 0) { println(i) break } for (j in 3..(i-1) step 2) { if (i.toInt() % j.toInt() == 0) { println(i) break } } } }