100920: [AtCoder]ABC092 A - Traveling Budget

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $100$ points

Problem Statement

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.

Constraints

  • $1 \leq A \leq 1$ $000$
  • $1 \leq B \leq 1$ $000$
  • $1 \leq C \leq 1$ $000$
  • $1 \leq D \leq 1$ $000$
  • All input values are integers.

Input

Input is given from Standard Input in the following format:

$A$
$B$
$C$
$D$

Output

Print the minimum total fare.


Sample Input 1

600
300
220
420

Sample Output 1

520

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

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


Sample Input 2

555
555
400
200

Sample Output 2

755

Sample Input 3

549
817
715
603

Sample Output 3

1152

Input

题意翻译

高桥君要从东京去大阪看望高桥君朋友,要乘坐一趟火车与一趟公交车 已知东京去大阪的火车有两个不一样票价,一个是$A$元,一个是$B$元 从大阪到朋友家的巴士一样有两个不一样票价,一个是$C$元,一个是$D$元 问高桥最少花费多少钱? 输入$1$≤$A,B,C,D$≤$1000$,满足它们都是整数 感谢$@RioBlu$的翻译

加入题单

上一题 下一题 算法标签: