
fun main(args:Array<String>):Unit {
    val waseda = Array(10){readLine()!!.toInt()}.sortedDescending()
    val keio = Array(10){readLine()!!.toInt()}.sortedDescending()
    println("${waseda.take(3).sum()} ${keio.take(3).sum()}")
}
