menu = [int(input()) for i in range(5)]
menu1=[]
menu2 = []
sum = 0
for i in range(5):
    if menu[i]%10 > 5:
        menu1.append(menu[i] + (10-(menu[i]%10)))
    elif menu[i]%10 == 0:
        menu1.append(menu[i])
    else:
        menu2.append(menu[i])

menu2.sort()

if len(menu2) > 1:
    for i in range(len(menu2)-1):
        menu2[i] += 10-(menu[i]%10)

menu1.extend(menu2)

for i in menu1:
    sum += i

print(sum)