object Main {
    def main(args: Array[String]) = {
        val in = io.Source.stdin.getLines.map(_.toInt)
        println((0 to 1).map(_ => in.take(10).toSeq.sorted.takeRight(3).sum).mkString(" "))
    }
}