using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp6
{
    class Program
    {

        static void Main(string[] args)
        {
            int[] a = new int[5];
            int dup = 0;
            int sum = 0;

            for (int i = 0; i < 5; ++i)
            {
                a[i] = int.Parse(Console.ReadLine());
            }
            int min = 10;
            int o = 0;



            for (int j = 0; j < 5; ++j)
            {
                int k = a[j] % 10;
                if (min > k && k != 0)
                {
                    min = k;
                    o = j;
                }
                if (k == 0) {
                    dup++;
                }
            }
            for (int l = 0; l < 5; ++l)
            {
                if (o != l)
                {
                    a[l] = a[l] +10-  a[l] % 10;
                }

            }
            for (int m = 0; m < 5; ++m)
            {

                sum = sum + a[m];

            }

            sum = sum - 10 *dup;

            Console.WriteLine(sum);




            Console.ReadKey();
        }
    }
}

