100 atcoder#ABC092A. [ABC092A] Traveling Budget

[ABC092A] Traveling Budget

Score : 100100 points

Problem Statement

You planned a trip using trains and buses. The train fare will be AA yen (the currency of Japan) if you buy ordinary tickets along the way, and BB yen if you buy an unlimited ticket. Similarly, the bus fare will be CC yen if you buy ordinary tickets along the way, and DD yen if you buy an unlimited ticket.

Find the minimum total fare when the optimal choices are made for trains and buses.

Constraints

  • 1A11 \leq A \leq 1 000000
  • 1B11 \leq B \leq 1 000000
  • 1C11 \leq C \leq 1 000000
  • 1D11 \leq D \leq 1 000000
  • All input values are integers.

Input

Input is given from Standard Input in the following format:

AA

BB

CC

DD

Output

Print the minimum total fare.

600
300
220
420
520

The train fare will be 600600 yen if you buy ordinary tickets, and 300300 yen if you buy an unlimited ticket. Thus, the optimal choice for trains is to buy an unlimited ticket for 300300 yen. On the other hand, the optimal choice for buses is to buy ordinary tickets for 220220 yen.

Therefore, the minimum total fare is 300+220=520300 + 220 = 520 yen.

555
555
400
200
755
549
817
715
603
1152