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

namespace cs
{
    public class Program
    {
        public static void Main(string[] args)
        {
        
        	int min = 11;
        	int sum = 0;
        	int input = 0;
        	int t = 0;
        	
        	for(int i = 0; i < 5; i++){
        		
        		input = int.Parse(Console.ReadLine());
        		if((t = input % 10) != 0){
        			min = Math.Min(min, t);
        			sum += (input / 10) * 10;
        			sum += 10;
        		
        		}else{
        			sum += input;
        		}
        	
        	}
        	if(min != 11) sum -= 10;
        	sum += min;
        	Console.WriteLine(sum);
        
        
        
        }
            
    }
}

