program main
  implicit none
  integer, parameter :: imax = 1010000
  integer :: d, n, i, cnt
  read(*, *) d, n
  cnt = 0
  do i = 1, imax
    if (div_hund(i) == d) then
      cnt = cnt + 1
      if (cnt == n) then
        write(*, "(i0)") i
        stop 0
      end if
    end if
  end do

  contains

  function div_hund(k)
    implicit none
    integer, intent(in) :: k
    integer :: div_hund, i, kcp
    if (k <= 0) stop 3
    kcp = k
    div_hund = 0
    do i = 1, 100
      if (mod(kcp, 100) == 0) then
        div_hund = div_hund + 1
        kcp = kcp / 100
      else
        exit
      end if
    end do
  end function div_hund
end program main
