Problems
421 - Max Pair Sum
SUBMIT PROBLEM

Max Pair Sum

Time Limit: 1 sec

 

The Problem

Make a simple program that reads four integer numbers named A, B, C, D. Calculate and print the max pair sum from all possible pair.

In other word find the max value from (A + B), (A + C), (A + D), (B + C), (B + D) and (C + D).

 

Example

If A = 4, B = 2, C = 1 and D = 3 then

All possible pairs are

(4, 2), (4, 1), (4, 3), (2, 1), (2, 3), and (1, 3)

So, the sum of all pairs are

4 + 2 = 6

4 + 1 = 5

4 + 3 = 7

2 + 1 = 3

2 + 3 = 5

1 + 3 = 4

The max sum is 7

 

The Input

Input file consist of several test cases. Each test case contains a line and each line will contains four integers A, B, C and D (0<A, B, C, D<10001). Input is terminated by EOF.

 

The Output

For each test case you should output a line. This line contains the value of the max pair sum.

 

Sample Input

4 2 1 3

10 5 3 11

3 8 7 6

 

Sample Output

7

21

15

 

 

 

 

Problem Setter: Shahin ShamS