menu = [0]*5
md = 300
time = 0
for i in range(5):
    menu[i] = int(input())
for i in range(5):
    huga = menu[i]%10
    if((huga<md)and(huga!=0)):
        x = menu[i]
        md = menu[i]%10
        index = i
#        print(md,index)
menu.pop(index)
for i in range(4):
    hoge = menu[i] % 10
    if hoge != 0:
        time = time + menu[i] + (10 - hoge)
    else:
        time = time + menu[i]

time  = time + x
print(time)