unittest
{
	assert( [ "600", "300", "220", "420" ].parse.expand.solve == 520 );
	assert( [ "555", "555", "400", "200" ].parse.expand.solve == 755 );
	assert( [ "549", "817", "715", "603" ].parse.expand.solve == 1152 );
}



import std.algorithm;
import std.conv;
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 a = input.front.strip.to!( long );
	input.popFront;
	auto b = input.front.strip.to!( long );
	input.popFront;
	auto c = input.front.strip.to!( long );
	input.popFront;
	auto d = input.front.strip.to!( long );
	return tuple( a, b, c, d );
}

auto solve( long a, long b, long c, long d )
{
	return min( a, b ) + min( c, d );
}
