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

class Myon{
    static void Main(string[] args){
        var myon = new Myon();
    }

    public Myon(){
        int[] time = new int[5];
        for(int i = 0;i < 5;i ++){
            time[i] = int.Parse(Console.ReadLine());
        }
        
        int[] amari = new int[5];
        for(int i = 0;i < 5;i ++){
            amari[i] = time[i]%10;
        }
        int timeProg = 0;
        int Min = 10;
        for(int i = 0;i < 5;i ++){
            if(amari[i] < Min)Min = amari[i];
            timeProg += time[i] - amari[i] + 10;
        }
        timeProg -= 10 - Min;
        Console.WriteLine(timeProg);
    }
}