#abc092a. [abc092_a]Traveling Budget
[abc092_a]Traveling Budget
Problem Statement
You planned a trip using trains and buses. The train fare will be yen (the currency of Japan) if you buy ordinary tickets along the way, and yen if you buy an unlimited ticket. Similarly, the bus fare will be yen if you buy ordinary tickets along the way, and yen if you buy an unlimited ticket.
Find the minimum total fare when the optimal choices are made for trains and buses.
Constraints
- All input values are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the minimum total fare.
Sample Input 1
600
300
220
420
Sample Output 1
520
The train fare will be yen if you buy ordinary tickets, and yen if you buy an unlimited ticket. Thus, the optimal choice for trains is to buy an unlimited ticket for yen. On the other hand, the optimal choice for buses is to buy ordinary tickets for yen.
Therefore, the minimum total fare is yen.
Sample Input 2
555
555
400
200
Sample Output 2
755
Sample Input 3
549
817
715
603
Sample Output 3
1152