object Main extends App {
  val pattern = "([0-9]+)".r

  val matches = for (str <- io.Source.stdin.getLines)
                  yield pattern.findAllIn(str)

  println(matches.flatten.map(_.toInt).sum)
}

