Score Calculation

Interview

Time limit1sMemory limit128 MB

Summary
Given 8 distinct problem scores, output the sum of the top 5 and their original indices in increasing order.
Level

Easy2 of 10

Topics
Sorting, Array, Implementation
Solved
No attempts yet

Problem

A contestant worked on 8 problems, and the score earned for each problem is given. A problem that was not solved has a score of 0. The contestant's final score is the sum of the 5 highest scores among the 8 scores.

Given the scores for all 8 problems, compute the final score and the problem numbers that contribute to it.

Input

The input consists of 8 lines. The i-th line contains the score for problem i. Each score is an integer between 0 and 150 inclusive, and all 8 scores are distinct.

Output

Print the sum of the 5 highest scores on the first line. On the second line, print the problem numbers corresponding to those 5 scores, separated by spaces. The problem numbers must be printed in increasing order.

Examples3

  1. Example 1

    Input
    20
    30
    50
    48
    33
    66
    0
    64
    
    Expected output
    261
    3 4 5 6 8
    
  2. Example 2

    Input
    20
    0
    50
    80
    77
    110
    56
    48
    
    Expected output
    373
    3 4 5 6 7
    
  3. Example 3

    Input
    20
    30
    50
    80
    110
    11
    0
    85
    
    Expected output
    355
    2 3 4 5 8