program cake_123
  implicit none
  integer :: x, y, z, k, i, j, m, n
  integer(8) :: a(1000), b(1000), c(1000), d(1000000)
  integer :: u, v, w
  a = 0_8
  b = 0_8
  c = 0_8
  d = 0_8
  read(*,*) x, y, z, k
  read(*,*) a(1:x)
  read(*,*) b(1:y)
  read(*,*) c(1:z)
  call merge_sort(x,a(1:x))
  call merge_sort(y,b(1:y))
  call merge_sort(z,c(1:z))
  if (x*y*z.le.100000) then
    do i = 1, x
      do j = 1, y
        do m = 1, z
          d(y*z*(i-1)+z*(j-1)+m) = a(i)+b(j)+c(m)
        end do
      end do
    end do
    call merge_sort(x*y*z,d(1:x*y*z))
    do i = 1, k
      write(*,'(i0)') d(i)
    end do
    stop
  end if
  u = x/10
  if (u.lt.1) u = x
  v = y/10
  if (v.lt.1) v = y
  w = z/10
  if (w.lt.1) w = z
  do i = 1, u
    do j = 1, v
      do m = 1, w
        d(v*w*(i-1)+w*(j-1)+m) = a(i)+b(j)+c(m)
      end do
    end do
  end do
  call merge_sort(u*v*w,d(1:u*v*w))
  do i = 1, k
    write(*,'(i0)') d(i)
  end do
contains
  subroutine merge_sort(n,c)
    implicit none
    integer, intent(in)       :: n
    integer(8), intent(inout) :: c(n)
    integer                   :: num, gth, i, ubnd
    num = n
    gth = 1
    do while (num.gt.1)
      do i = 1, num/2
        ubnd = min(2*i*gth,n)
        call merge(c(2*(i-1)*gth+1:(2*i-1)*gth),c((2*i-1)*gth+1:ubnd))
      end do
      gth = 2*gth
      num = (num+1)/2
    end do
    return
  end subroutine merge_sort
  
  subroutine merge(c1,c2)
    implicit none
    integer(8), intent(inout) :: c1(:), c2(:)
    integer(8)                :: c(size(c1)+size(c2))
    integer                   :: i1, i2, n1, n2
    i1 = 1
    i2 = 1
    n1 = size(c1)
    n2 = size(c2)
    do while (i1.le.n1.and.i2.le.n2)
      if (c1(i1).ge.c2(i2)) then
        c(i1+i2-1) = c1(i1)
        i1 = i1+1
      else
        c(i1+i2-1) = c2(i2)
        i2 = i2+1
      end if
    end do
    if (i1.le.n1) then
      c(i1+i2-1:n1+n2) = c1(i1:n1)
    else if (i2.le.n2) then
      c(i1+i2-1:n1+n2) = c2(i2:n2)
    end if
    c1 = c(1:n1)
    c2 = c(n1+1:n1+n2)
    return
  end subroutine merge
end program cake_123