#a,b,c = map(int,inpput().split(" "))
#n = int(input())
#print(a,b,c)
t=[]
for i in range(5):
    t.append(int(input()))
#n = int(input())
def dif(x):
    s = int(a/10)
    return (s+1)*10 -x

def comp(a,b):
    a1 = dif(a)
    b1 = dif(b)
    return a1 < b1
d = sorted(t, cmp=dif(a,b), reverse=True)

sum = 0
for i in range(4):
    if int(d[i]/10)*10 ==d[i]:
        sum = sum+d[i]
    else:
        sum += (int(d[i]/10)+1)*10
print(sum + d[4])