#C10617. Find Minimum, Maximum, and Sum of a List

    ID: 39842 Type: Default 1000ms 256MiB

Find Minimum, Maximum, and Sum of a List

Find Minimum, Maximum, and Sum of a List

Given a list of integers, you are required to determine the smallest integer, the largest integer, and the sum of all integers between them (inclusive) when the list is sorted in ascending order. If the list is empty, output None for both the minimum and maximum values, and 0 for the sum.

Formally, if the sorted list is \(A\), you need to output:

$$\min(A),\;\max(A),\;\sum_{i=1}^{n}A_i$$

where \(A_i\) denotes the elements of the list.

inputFormat

The input is given via standard input (stdin). The first line contains an integer \(N\), representing the number of integers. If \(N > 0\), the second line contains \(N\) space-separated integers.

outputFormat

Output three values separated by a space: the smallest integer, the largest integer, and the sum of all integers between them (inclusive). For an empty list (i.e. when \(N=0\)), output None None 0.

## sample
5
4 1 3 2 5
1 5 15