import math

list_aaa =[int(input()) for i in range(5)]

keta_1 = []

for i in range(5):
    if str(list_aaa[i])[-1:] =="0":
        keta_1.append("9")
    else:
        keta_1.append(str(list_aaa[i])[-1:])
aaa_index = (keta_1.index(min(keta_1,key= lambda x: int(x))))
#print(keta_1)
#print(aaa_index)

aaa =list_aaa.pop(aaa_index)
bbb =list(map(lambda x: round(x,-1),list_aaa))

#print(aaa)
#print(bbb)
sum_bbb= sum(list(map(lambda x: round(x,-1),list_aaa)))


print(sum_bbb+aaa)