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

namespace ProgrammingContestCS.AtCoder.ABC123
{
    class B
    {
        static void Main()
        {
            DataReader reader = new DataReader();
            int[] A = new int[5];
            for (int i = 0; i < 5; ++i)
            {
                A[i] = reader.ReadInt();
            }
            int ans = Int32.MaxValue;
            var Pa = P(A.ToList());
            foreach (List<int> a in Pa)
            {
                int t = 0;
                for (int i = 0; i < 5; ++i)
                {
                    t += a[i];
                    if (i < 4 && t % 10 > 0)
                    {
                        t = t + 10 - (t % 10);
                    }
                }
                ans = Math.Min(t, ans);
            }
            Console.WriteLine(ans);
        }
        static void zMain()
        {
            DataReader reader = new DataReader();
            int[] A = new int[5];
            for (int i = 0; i < 5; ++i)
            {
                A[i] = reader.ReadInt();
            }
            foreach (var s in P(A.ToList()))
            {
                for (int i = 0; i < s.Count; ++i)
                {
                    Console.Write(s[i] + " ");
                }
                Console.WriteLine();
            }
        }
        static List<List<int> > P(List<int> a)
        {
            if (a.Count == 1)
            {
                return new List<List<int>> { new List<int>() { a[0] } };
            }
            var ret = new List<List<int>>() { };
            for (int i = 0; i < a.Count; i++)
            {
                var c = new List<int>(a);
                c.RemoveAt(i);
                var pc = P(new List<int>(c));
                foreach (var t in pc)
                {
                    var cc = new List<int>(t);
                    cc.Insert(0, a[i]);
                    ret.Add(new List<int>(cc));
                }
            }
            return ret;
        }
    }
}
class DataReader
{
    const char DEFAULT_SEPARATOR = ' ';
    public System.IO.TextReader Reader { get; set; }
    public char[] Separators { get; set; }
    System.Collections.Generic.Queue<string> data;
    public DataReader() : this(System.Console.In, new char[] { DEFAULT_SEPARATOR }) { }
    public DataReader(System.IO.TextReader reader, char[] separators)
    {
        Reader = reader;
        Separators = separators;
        data = new System.Collections.Generic.Queue<string>();
    }
    public string ReadString()
    {
        if (data.Count == 0)
        {
            ReadLineAndEnqueue();
        }
        string s = data.Dequeue();
        return s;
    }
    public int ReadInt()
    {
        string s = ReadString();
        int x = int.Parse(s);
        return x;
    }
    public long ReadLong()
    {
        string s = ReadString();
        long x = long.Parse(s);
        return x;
    }
    public double ReadDouble()
    {
        string s = ReadString();
        double x = double.Parse(s);
        return x;
    }
    void ReadLineAndEnqueue()
    {
        string s = Reader.ReadLine().Trim();
        if (s != null)
        {
            string[] ss = s.Split(Separators);
            foreach (string e in ss)
            {
                data.Enqueue(e);
            }
            return;
        }
        else
        {
            throw new System.IO.IOException("End of data");
        }
    }
}


Measured memory_bytes: 13268