P27232 [AtCoder] Selecting Subjects
普及
题目描述

Problem Description

JOI has taken tests in Physics, Chemistry, Biology, Geology, History, and Geography. Each test is scored out of 100 points.

JOI needs to choose 3 subjects from Physics, Chemistry, Biology, and Geology, and 1 subject from History and Geography.

Determine the highest possible total score of the tests from the subjects JOI chooses.


Input Format

The input consists of 6 lines, each containing one integer.

The first line contains JOI's score in Physics, \( A \).
The second line contains JOI's score in Chemistry, \( B \).
The third line contains JOI's score in Biology, \( C \).
The fourth line contains JOI's score in Geology, \( D \).
The fifth line contains JOI's score in History, \( E \).
The sixth line contains JOI's score in Geography, \( F \).

All integers \( A, B, C, D, E, F \) are between 0 and 100 inclusive.

Output Format

Output the total score of the tests from the subjects JOI chooses in one line.


Sample Input and Output

Sample Input #1

100
34
76
42
10
0

Sample Output #1

228

Sample Input #2

15
21
15
42
15
62

Sample Output #2

140

Notes/Hints

Sample Explanation 1

In Sample Input #1, the highest total score is achieved when JOI chooses Physics, Biology, Geology, and History. The scores for these subjects are 100, 76, 42, and 10 respectively, resulting in a total score of 228.


Sample Explanation 2

In Sample Input #2, the highest total score is achieved when JOI chooses Chemistry, Biology, Geology, and Geography. The scores for these subjects are 21, 15, 42, and 62 respectively, resulting in a total score of 140. In this case, choosing Physics, Chemistry, Geology, and Geography would also result in a total score of 140.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
100 34 76 42 10 0
样例输出
228