#K52357. Sum of the Largest and Smallest Integers

    ID: 29291 Type: Default 1000ms 256MiB

Sum of the Largest and Smallest Integers

Sum of the Largest and Smallest Integers

Given a space-separated string of integers, your task is to compute the sum of the largest and the smallest integers in the list.

Let \( \text{min} \) be the minimum integer and \( \text{max} \) the maximum integer from the list. Then the answer is computed as \( \text{ans} = \text{min} + \text{max} \).

For example, if the input is "4 2 -7 5 3", the smallest integer is -7 and the largest is 5, so the output should be -2.

inputFormat

The input is provided via standard input (stdin) as a single line containing space-separated integers.

\( n_1 \ n_2 \ \ldots \ n_k \)

outputFormat

The output should be written to standard output (stdout) as a single integer which is the sum of the smallest and largest integers in the input.

\( \text{output} = \min + \max \)

## sample
4 2 -7 5 3
-2