import math

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

keta_1 = []

for i in range(5):
    keta_1.append(str(list_aaa[i])[-1:])
aaa_index = (keta_1.index(min(keta_1,key= lambda x: int(x)>=1)))

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


print(sum_aaa+aaa)