Option Explicit On
Option Strict On

Imports System.Collections.Generic

Module Module1

    Sub Main()

        Dim X As Integer = CInt(Console.ReadLine())
        Dim R As Integer = X
        Dim s As New List(Of Integer)
        Dim i As Integer

        Do

            For i = 2 To R
                If R Mod i <> 0 Then
                    s.Add(i)
                Else
                    Exit For
                End If
            Next

            If i >= R AndAlso s.Count() > 0 Then
                Exit Do
            End If

            If R = 2 Then
                Exit Do
            End If

            R += 1
            s.Clear()

        Loop

        Console.WriteLine(R)
        ’Console.ReadLine()

    End Sub

End Module

