
program main
    implicit none
    logical::isPrime(55555)
    integer::arr(55555)
    integer::i,j,k,t,N
    do i=1,size(isPrime)
        isPrime(i)=.true.
    end do
    isPrime(1)=.false.
    do i=2,size(isPrime)
        if(isPrime(i))then
            do j=2*i,size(isPrime),i
                isPrime(j)=.false.
            end do
        end if
    end do
    t=1
    do i=2,size(isPrime)
        if(isPrime(i).and.mod(i,5)==1)then
            arr(t)=i
            t=t+1
        end if
    end do
    read*,N
    print*,(arr(i),i=1,N)


end program
