l =[]
for i in range(5):
    a = int(input())
    l.append(a)

x =[]
j=[]
for i in l:
    t = i%10
    if t != 0:
        x.append(t)
        j.append(i+10-t)
    else:
        j.append(i)

print(sum(j)-10+min(x))