import scala.io.StdIn.readInt

object Main extends App {
  val s1 = {for(i<-1 to 4) yield readInt }.sortWith(_>_).take(3).sum
  val h = readInt
  val g = readInt
  val s2 = if(h>g) h else g
  println(s1+s2)
}