P7614 [COCI 2011/2012 #2] NAJBOLJIH 5

Description

Given $8$ numbers $X_1, X_2, ..., X_8$, choose $5$ of them so that the sum of these $5$ numbers is as large as possible. Output the sum of these $5$ numbers and their indices. The index of $X_i$ is $i$.

Input Format

The input has $8$ lines. The $i$-th line contains a positive integer $X_i$. **It is guaranteed that all $X_i$ are distinct**.

Output Format

The output has two lines. The first line contains an integer, representing the maximum possible sum. The second line contains $5$ integers, representing the indices of the chosen $5$ numbers, **sorted in ascending order**.

Explanation/Hint

#### Constraints For $100\%$ of the testdata, $1 \le X_i \le 150$. #### Notes The score for this problem follows the original COCI setting, with a full score of $50$. Translated from **[COCI2011-2012](https://hsin.hr/coci/archive/2011_2012/) [CONTEST #2](https://hsin.hr/coci/archive/2011_2012/contest2_tasks.pdf)** ___T1 NAJBOLJIH 5___. Translated by ChatGPT 5