program main
implicit None
	integer(8)::x,y,z,k,i,j
	integer(8),allocatable::a(:),b(:),c(:),d(:),e(:)
	
	read*,x,y,z,k
	allocate(a(x),b(y),c(z),d(x*y),e(k*z))
	read*,a;read*,b;read*,c
	
	do i =1,x
		do j =1,y
			d((i-1)*y+j) = a(i)+b(j)
		enddo
	enddo
	
	call h1(d,x*y)
	call rev(d,x*y)
	e = 0
	
	do i =1,k
		do j = 1,z
			e((i-1)*z+j) = d(i)+c(j)
		enddo
		if((i+1)>x*y)exit
	enddo
	
	call h1(e,k*z)
	call rev(e,k*z)
	
	do i = 1,k
		print"(i0)",e(i)
	enddo
end program main

subroutine rev(a,n)
Implicit None
	integer(8)::a(n),b(n)
	integer(8)::n,i
	
	do i =1,n
	b(i) = a(n-i+1)
	enddo
	
	a =b
end subroutine rev

subroutine h1(a,n)
implicit None
	integer(8)::a(n),x
	integer(8)::n,i,ie,i0,i1,i2
	
	do i = n/2,1,-1
		x = a(i);ie = n + 1; i0 = i; i1 = i0 * 2
		do while(i1 < ie)
			i2 = i1 + 1
			if(i2 < ie .and. a(i1) < a(i2)) i1 = i2
			if(a(i1) > x)then
				a(i0) = a(i1);a(i1) = x
				else
				exit
			endif
			i0 = i1;i1 = i0 *2
		enddo
	enddo
	do ie = n,2,-1
		x = a(ie)
		a(ie) = a(1)
		a(1) = x
		i0 =1;i1 =2
		do while(i1 <ie)
			i2 = i1 +1
			if(i2 < ie .and. a(i1) < a(i2)) i1 = i2
			if(a(i1) > x)then
				a(i0) = a(i1);a(i1) = x
				else
				exit
			endif
			i0 = i1;i1 = i0 *2
		enddo
	enddo
end subroutine h1