import scala.io.StdIn.readInt

object Main {
  def main(args:Array[String]) = {
    val w = { for(i <- 1 to 10) yield readInt }.sortWith( _ > _ ).take(3).sum
    val k = { for(i <- 1 to 10) yield readInt }.sortWith( _ > _ ).take(3).sum
    println(w + " " + k)
  }
}