unittest
{
	assert( [ "1 2 10 20 15 200" ].parse.expand.solve == "110 10" );
	assert( [ "1 2 1 2 100 1000" ].parse.expand.solve == "200 100" );
	assert( [ "17 19 22 26 55 2802" ].parse.expand.solve == "2634 934" );
}



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

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

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto abcdef = input.front.split.to!( long[] );
	return tuple( abcdef[ 0 ], abcdef[ 1 ], abcdef[ 2 ], abcdef[ 3 ], abcdef[ 4 ], abcdef[ 5 ] );
}

auto solve( long a, long b, long c, long d, long e, long f )
{
	a *= 100;
	b *= 100;
	
	auto ws = memoize!combisum( a, b, f );
	ws.popFront;		// 0は削る
	
	auto pm = -1.0f;
	auto wm = 0L;
	auto sm = 0L;
	foreach( w; ws )
	{
		auto st = min( w / 100 * e, f - w );
		auto s = memoize!combisum( c, d, st ).reduce!max;
		auto p = 100.0f * s / ( w + s );
		
		if( pm < p )
		{
			pm = p;
			wm = w;
			sm = s;
		}
	}
	
	return format( "%d %d", wm + sm, sm );
}

auto combisum( long x, long y, long t )
{
	long[] cs;
	
	for( auto xi = 0; true; xi++ )
	{
		auto xc = x * xi;
		if( t < xc ) break;
		
		for( auto yi = 0; true; yi++ )
		{
			auto yc = y * yi;
			auto c = xc + yc;
			if( t < xc + yc ) break;
			
			cs ~= xc + yc;
		}
	}
	
	return cs.sort().uniq;
}
