import scala.collection.mutable.PriorityQueue

object Main {

  def main(args: Array[String]) = {
    val lines = scala.io.Source.stdin.getLines.toStream

    val Array(num_x, num_y, num_z, num_k) = lines(0).split(" ").map(_.toInt)
    var xs = lines(1).split(" ").map(_.toInt)
    var ys = lines(2).split(" ").map(_.toInt)
    var zs = lines(3).split(" ").map(_.toInt)
    java.util.Arrays.sort(xs)
    java.util.Arrays.sort(ys)
    java.util.Arrays.sort(zs)
    var xsi = xs.reverse.toList
    var ysi = ys.reverse.toList
    var zsi = zs.reverse.toList

    var x = xsi.head
    var y = ysi.head
    var z = zsi.head

    var cnt = 0
    val pq = PriorityQueue[((Int, Char), (List[Int], List[Int], List[Int]))]()(scala.math.Ordering.by((v: ((Int, Char), (List[Int], List[Int], List[Int]))) => v._1))
    pq.enqueue((x + y + z, 'w') -> (xsi, ysi, zsi))
    dfs(pq, num_k, 0)
  }

  def dfs(q: PriorityQueue[((Int, Char), (List[Int], List[Int], List[Int]))], max: Int = 3000, count: Int = 0): Unit = {
    val ((value, c), (lx, ly, lz))  = q.dequeue
    println(value)
    if (lx.tail.nonEmpty) {
      q.enqueue((value - lx.head + lx.tail.head, 'x') -> (lx.tail, ly, lz))
    }
    if (ly.tail.nonEmpty) {
      q.enqueue((value - ly.head + ly.tail.head, 'y') -> (lx, ly.tail, lz))

    }
    if (lz.tail.nonEmpty) {
      q.enqueue((value - lz.head + lz.tail.head, 'z') -> (lx, ly, lz.tail))
    }

    if (count < max && (lz.tail.nonEmpty || ly.tail.nonEmpty || lx.tail.nonEmpty)) {
      dfs(q, max, count + 1)
    }
  }
}
