using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
class Program
{
    static void Main()
    {
        //入力
        //int n = 100;
        int[] input = new int[5];
        for(int a = 0; a < 5; a++)
        {
            input[a]=int.Parse(Console.ReadLine());
        }
        //int[] input = "5 100".Split().Select(i=>int.Parse(i)).ToArray();
        
        var sortList=input.OrderBy(i => abc(i)).ToArray();
        double total = 0;
        Console.WriteLine(string.Join(",",sortList));
        for(int a = 0; a < 5; a++)
        {
            if (a == 4) 
            {
                    total += (double)sortList[a];
            }else{
                total += Math.Ceiling((double)sortList[a] / 10) * 10;

            }
            
            
        }
        
        /*
        for(int a = 0; a < 5; a++)
        {
            for (int b = 0;b < 5; b++)
            {
                for (int c = 0; c < 5; c++)
                {
                    for (int d = 0; d < 5; d++)
                    {
                        for (int e = 0; e < 5; e++)
                        {

                        }
                    }
                }
            }
        }
        */
        /*
        int n = input[0];
        int q = input[1];
        //int seed = Environment.TickCount;

    */
        Console.WriteLine((int)total);

        /*
        //処理速度計測
        var sw = new System.Diagnostics.Stopwatch();
        sw.Start();
        //解法

        //処理速度表示
        sw.Stop();
        TimeSpan ts = sw.Elapsed;
        Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms");
        */
        Console.ReadLine();
        
    }
    static int abc(int i)
    {
        int val = 10 - i % 10;
        if (val == 10)
        {
            val = 0;
        }
        return val;
    }
}