
object Main extends App {

  import scala.io.StdIn._
  val pasta = Array.tabulate(3){_ ⇒ readLine.trim.toInt}.min
  val juice = Array.tabulate(2){_ ⇒ readLine.trim.toInt}.min
  println(
    pasta + juice - 50
  )
}

