AtCoder Beginner Contest 092
A
Traveling Budget
AtCoder
⌀ 0
原题
←B →
翻译中…

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.

翻译中…

样例

Input #1
600
300
220
420
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.
Input #2
555
555
400
200
Output #2
755
Input #3
549
817
715
603
Output #3
1152
题目信息
题号
abc092_a
时间限制
2 s
内存限制
256 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。