using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp2
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine());
            int B = int.Parse(Console.ReadLine());
            int C = int.Parse(Console.ReadLine());
            int D = int.Parse(Console.ReadLine());
            int E = int.Parse(Console.ReadLine());

            int[] data = new int[5] { A, B, C, D, E };
            int ans = 0;
            int min = 0;
            foreach (int item in data)
            {
                
                int r = item % 10;
                if (r == 0)
                {
                    ans += item;
                }
                else
                {
                    ans += (item / 10) * 10 + 10;
                    if (r < min||min==0) min = r;
                }
                
            }

            Console.WriteLine("最小時間は" + min);

            Console.WriteLine(ans-(10-min));
        }



        private static int[] Read(string input)
        {
            string[] inputs = input.Split(' ');
            int num = inputs.Length;
            int[] ints = new int[num];
            for (int i = 0; i < num; i++)
            {
                ints[i] = int.Parse(inputs[i]);
            }
            
            return ints;
        }


    }
}
