program number_of_digits
  implicit none
  integer(8), parameter :: md = 1000000007_8, u = 100000000_8
  integer(8) :: s, ans = 0_8, tmp = 1_8, i, k
  integer(8) :: l = 1_8, r = 1_8, dl = 1_8, dr = 1_8, nxtl = 10_8, nxtr = 10_8
  read(*,*) s
  do while (l < u)
    do while (tmp < s)
      r = r+1_8
      if (r == nxtr) then
        dr = dr+1_8
        nxtr = nxtr*10_8
      end if
      tmp = tmp+dr
    end do
    if (tmp == s) ans = ans+1_8
    tmp = tmp-dl
    l = l+1_8
    if (l == nxtl) then
      dl = dl+1_8
      nxtl = nxtl*10_8
    end if
  end do
  do i = 1_8, s
    k = s/i
    if (k <= 8) exit
    if (mod(s,i) == 0_8) then
      ans = modulo(ans+9_8*pow(10_8,int(k-1_8))-i+1_8,md)
    else
      ans = mod(ans+1_8,md)
    end if
  end do
  write(*,'(i0)') ans
contains
  function pow(a,b) result(r)
    integer(8), intent(in) :: a
    integer, intent(in) :: b
    integer(8) :: r, p
    integer :: k
    r = 1_8
    p = a
    k = b
    do while (k > 0)
      if (btest(k,0)) r = mod(r*p,md)
      p = mod(p*p,md)
      k = rshift(k,1)
    end do
  end
end program number_of_digits