#K9086. Sum of Largest and Smallest Numbers

    ID: 37846 Type: Default 1000ms 256MiB

Sum of Largest and Smallest Numbers

Sum of Largest and Smallest Numbers

You are given a list of integers. Your task is to compute the sum of the smallest and largest integer in the list.

If the list is empty, output "The list cannot be empty".

Mathematically, let \( m = \min_{i} a_i \) and \( M = \max_{i} a_i \), then your answer is \( m + M \).

inputFormat

The input is given via stdin and consists of two lines:

  • The first line contains an integer n representing the number of elements in the list.
  • The second line contains n space-separated integers.

If n equals 0, the list is empty.

outputFormat

Print the sum of the smallest and largest numbers to stdout. For an empty list (n = 0), print exactly "The list cannot be empty".

## sample
5
1 2 3 4 5
6