val P = 1000000007L

val POW10S = listOf(1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000)

data class FiniteField(val x: Long) {
  operator fun plus(o: FiniteField) = FiniteField((x + o.x) % P)
  operator fun plus(o: Int) = this + FiniteField(o.toLong())
  operator fun minus(o: FiniteField) = FiniteField((x + P - o.x) % P)
  operator fun minus(o: Int) = this - FiniteField(o.toLong())
  operator fun times(o: FiniteField) = FiniteField((x * o.x) % P)
}

fun pow10(p: Int): FiniteField {
  if (p == 0) return FiniteField(1)
  if (p % 2 == 1) {
    val x = pow10(p / 2)
    return x * x * FiniteField(10)
  } else {
    val x = pow10(p / 2)
    return x * x
  }
}

fun isValid(l: Int, s: Int): Boolean {
  var r = s
  var b = l
  for (d in 1..9) {
    if (b < POW10S[d]) {
      val count = POW10S[d] - b
      if (r <= count * d) {
        return r % d == 0
      } else {
        b = POW10S[d]
        r -= count * d
      }
    }
  }
  throw RuntimeException()
}

fun main(args: Array<String>) {
  val s = readLine()!!.toInt()

  // l in [1, 10 ^ 7) (d <= 7)
  val lowCount = (1..9999999).count { isValid(it, s) }
  var ans = FiniteField(lowCount.toLong())

  // l in [10 ^ 7, +inf) (d >= 8)
  for (d in 8..s) {
    if (s % d == 0) {
      val x0 = s / d
      // d-digits only
      ans += (pow10(d) - pow10(d - 1) - x0 + 1)
      // d-digits and (d + 1)-digits
      ans += x0 / (d + 1) - (if (x0 % (d + 1) == 0) 1 else 0)
    } else {
      val xm = s / d
      val r = s % d
      val x0 = xm - r
      if (x0 <= 0) continue
      ans += 1
      ans += x0 / (d + 1) - (if (x0 % (d + 1) == 0) 1 else 0)
    }
  }

  println(ans.x)
}
