You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket.  Find the minimum total fare when the optimal choices are made for trains and buses.
A = input()
B = input()
C = input()
D = input()

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

print((min(A,B))+(min(C,D)))