program example
	implicit none
    
    integer(8) :: X,i,j
    
    read(*,*) X
    
    i=X
    
    do
   
    	do j=2,i
        
        	if (i==2) then
            	write(*,*) i
                goto 1
        	else if (mod(i,j)==0) then
            	exit
            end if
        end do
        
        if(j==i) then
        	write(*,*) i
            exit
        end if
        
        i=i+1
        
    end do
    
1 end program example