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

namespace AtCoderTemplate
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Scanner.rescanint(5);
            var b = a.Where(x => x[0] % 10 == 0).ToArray();
            var c = a.Where(x => x[0] % 10 != 0).OrderByDescending(x => x[0] % 10).ToArray();
            var res = 0;
            for (var i = 0; i < c.Length - 1; i++) res += c[i][0] + (10 - c[i][0] % 10);
            for (var i = 0; i < b.Length; i++) res += b[i][0];
            Console.WriteLine(res + c[c.Length-1][0]);
        }
    }

    public class Scanner
    {
        public static string[] scan => Console.ReadLine().Split(' ');
        public static int[] scanint => Array.ConvertAll(scan, int.Parse);
        public static long[] scanlong => Array.ConvertAll(scan, long.Parse);
        public static string[][] rescan(int n) => Enumerable.Repeat(0, n).Select(_ => scan).ToArray();
        public static int[][] rescanint(int n) => Enumerable.Repeat(0, n).Select(_ => scanint).ToArray();
        public static long[][] rescanlong(int n) => Enumerable.Repeat(0, n).Select(_ => scanlong).ToArray();

    }

    public class Ex
    {
        public static int[] subarr(int[] arr, int begin, int n) { int[] a = new int[arr.Length]; Array.Copy(arr, begin, a, 0, n); return a; }
    }
}
