local a = tonumber(io.read())
local b = tonumber(io.read())
local c = tonumber(io.read())
local d = tonumber(io.read())

local aa = 0
local bb = 0

if a < b then
    aa = a
elseif a == b then
    aa = a
else
    aa = b
end

if c < d then
    bb = c
elseif c == d then
    bb = c
else
    bb = d
end
print(aa+bb)