program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i,j,pn=0
    logical:: is_prime(2:55555)
    integer(int32), allocatable:: p(:)

    read*, n
    is_prime(:) = .true.
    do i=2,55555
        if (.not. is_prime(i)) cycle
        j = 2
        pn=pn+1
        do while(i*j <= 55555)
            is_prime(i*j) = .false.
            j=j+1
        end do
    end do
    allocate(p(pn))
    j=1
    do i=2,55555
        if (.not. is_prime(i)) cycle
        p(j) = i
        j=j+1
    end do
    print'(*(i0,1x))', p(pn-n+1:pn)
end program main