# -*- coding: utf-8 -*-                                                                                                                                                                  


import sys
import numpy as np
import math

def ReadInputNum():
    input_num=[]
    for i in range(5):
        input_num.append(int(input()))
    return tuple(input_num)

def CheckRangeInput(*argv):
    for num in argv:
        if num<=123 and isinstance(num,int):
            pass
            # print("good")                                                                                                                                                              
        else:
            print("input"+ num +"is unexpected.")
            sys.exit()


def SumTotalTime(Tuple_Input):
    list_input=list(Tuple_Input)
    # print(list_input)                                                                                                                                                                  
    list_tmp=np.array(list_input)
    amari=(list_tmp-1)%10
    amari=amari.tolist()
    # print(amari)                                                                                                                                                                       
    last_one=min(amari)
    # print(last_one)                                                                                                                                                                    
    last_one=list_input.pop(amari.index(last_one))
    print(last_one)
    print(list_input)

    out_put=0
    for i in list_input:
        out_put += math.ceil(i/10)*10
    # print(out_put)                                                                                                                                                                     
    print(out_put+last_one)



A,B,C,D,E = ReadInputNum()
CheckRangeInput(A,B,C,D,E)
tuple_input = (A,B,C,D,E)
SumTotalTime(tuple_input)
