using System.Linq;
using static System.Math;
using System;

public class Hello
{
    public static void Main()
    {
        var a = new int[5];
        var b = new int[5];
        for (int i = 0; i < 5; i++)
        {
            a[i] =  int.Parse(Console.ReadLine().Trim());
            b[i] = a[i] % 10;
        }
        var t = 100;
        for (int i = 0; i < 5; i++)
        {
            if (b[i] != 0) t = Min(t, b[i]);
        }
        if (t == 100) { Console.WriteLine(a.Sum()); goto exit; }
        var ans = 0;
        for (int i = 0; i < 5; i++)
        {
            if (b[i] != t) ans += ((a[i] + 9) / 10) * 10;
            else ans += a[i];
        }
        Console.WriteLine(ans);
        exit:;
    }
}