
object Main extends App {

  import scala.io.StdIn._

  val s = readLine.trim.toArray.map{_.asDigit}.toList
  println(
    calPattern(s)
  )
  def calPattern(chars: List[Int], count: Int = 4): Int = {
    if (count == 1){
      if (chars.isValidAsIpSegment) 1
      else 0
    }else {
      List(1, 2, 3).filter(l ⇒ chars.length >= l && chars.take(l).isValidAsIpSegment).map(l ⇒ calPattern(chars.drop(l), count - 1)).sum
    }
  }
  implicit class Ex(val list: List[Int]){
    def isValidAsIpSegment: Boolean = {
      list.nonEmpty && ((list.head == 0 && list.length == 1) || (list.head != 0 && list.toInt <= 255))
    }
    def toInt: Int = list.foldLeft(0){case (a, b) ⇒ a * 10 + b}
  }
  implicit class Extenion[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}
