unittest
{
	assert( [ "2 2 2 8", "4 6", "1 5", "3 8" ].parse.expand.solve == "19\n17\n15\n14\n13\n12\n10\n8" );
	assert( [ "3 3 3 5", "1 10 100", "2 20 200", "1 10 100" ].parse.expand.solve == "400\n310\n310\n301\n301" );
	assert( [
			"10 10 10 20",
			"7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488",
			"1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338",
			"4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736"
		].parse.expand.solve == "23379871545\n22444657051\n22302177772\n22095691512\n21667941469\n21366963278\n21287912315\n21279176669\n21160477018\n21085311041\n21059876163\n21017997739\n20703329561\n20702387965\n20590247696\n20383761436\n20343962175\n20254073196\n20210218542\n20150096547" );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto xyzk = input.front.split.to!( long[] );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	input.popFront;
	auto bs = input.front.split.to!( long[] );
	input.popFront;
	auto cs = input.front.split.to!( long[] );
	return tuple( xyzk[ 3 ], as, bs, cs );
}

auto solve( long k, long[] as, long[] bs, long[] cs )
{
	as.sort!( ( a, b ) => b < a );
	bs.sort!( ( a, b ) => b < a );
	cs.sort!( ( a, b ) => b < a );
	
	auto abcs = [ as, bs, cs ];
	auto pss = [ [ 0L, 0L, 0L ] ];
	auto ts = [ 0L:[ 0L:[ 0L: ( as[ 0 ] + bs[ 0 ] + cs[ 0 ] ) ] ] ];
	
	// pss[ 0 .. pi ]は順番確定済、pss[ pi .. $ ]は順番未確定
	for( auto pi = 1L; pi < k; pi++ )
	{
		// 順番確定済の最後のやつから次の候補を計算
		for( auto abci = 0L; abci < abcs.length; abci++ )
		{
			if( pss[ pi - 1 ][ abci ] + 1 < abcs[ abci ].length )
			{
				auto ps = pss[ pi - 1 ].dup;
				ps[ abci ]++;
				
				// 候補が未確定領域に無かったら追加
				if( ps[ 0 ] !in ts || ps[ 1 ] !in ts[ ps[ 0 ] ] || ps[ 2 ] !in ts[ ps[ 0 ] ][ ps[ 1 ] ] )
				{
					ts[ ps[ 0 ] ][ ps[ 1 ] ][ ps[ 2 ] ] = as[ ps[ 0 ] ] + bs[ ps[ 1 ] ] + cs[ ps[ 2 ] ];
					pss ~= ps;
				}
			}
		}
		
		// 未確定領域を美味しい順に並べ替え
		pss[ pi .. $ ].sort!( ( a, b ) => ts[ b[ 0 ] ][ b[ 1 ] ][ b[ 2 ] ] < ts[ a[ 0 ] ][ a[ 1 ] ][ a[ 2 ] ] );
	}
	
	auto anss = pss[ 0 .. k ].map!( ( a ) => ts[ a[ 0 ] ][ a[ 1 ] ][ a[ 2 ] ] );
	return anss.map!( to!string ).join( "\n" );
}
