A = int(eval(input()))

B = int(eval(input()))

C = int(eval(input()))

D = int(eval(input()))



if( A < B):

  if(C < D):

    print((A + C))

    

  else:

    print((A + D))

    

else:

  if(C < D):

    print((B + C))

  

  else:

    print((B + D))

A = int(eval(input()))

B = int(eval(input()))

C = int(eval(input()))

D = int(eval(input()))



E = min(A, B)

F = min(C, D)



print((E + F))
A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
D = int(eval(input()))
if A < B:
    if C < D:
        print((A + C))
    else:
        print((A + D))
else:
    if C < D:
        print((B + C))
    else:
        print((B + D))

A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
D = int(eval(input()))
E = min(A, B)
F = min(C, D)
print((E + F))

-if A < B: -    if C < D: -        print((A + C)) -    else: -        print((A + D)) -else: -    if C < D: -        print((B + C)) -    else: -        print((B + D)) +E = min(A, B) +F = min(C, D) +print((E + F))