menu_time=[]
total_time = 0
last_time = 9
for i in range(0,5):
    a = int(input())
    menu_time.append(a)
for i in range(0,5):
    if menu_time[i]%10==0:
        total_time+=menu_time[i]
    else:
        total_time+=(menu_time[i]//10+1)*10
for i in range(0,5):
    if menu_time[i]%10!=0 and menu_time[i]%10<last_time:
        last_time = menu_time[i]%10
    else:
        dum=0
total_time+=last_time-10
print(total_time)
