print((eval('+min(%s)'%('int(input()),'*2)*2)))
print(eval('+min(%s)'%('input(),'*2)*2))
print((eval("+min(%s)" % ("int(input())," * 2) * 2)))

print(eval("+min(%s)" % ("input()," * 2) * 2))

-print((eval("+min(%s)" % ("int(input())," * 2) * 2))) +print(eval("+min(%s)" % ("input()," * 2) * 2))