import std.stdio;
import std.range;
import std.array;
import std.algorithm;
import std.string;
import std.conv;

void main(){
    immutable train_01 = readln.chomp.to!int;
    immutable train_02 = readln.chomp.to!int;
    immutable bus_01 = readln.chomp.to!int;
    immutable bus_02 = readln.chomp.to!int;

    immutable answer = min(train_01, train_02) + min(bus_01, bus_02);
    writeln(answer);
}