a = [0]*(5)
for l in range(5):
    a[l] = str(input())
ls = [a[0],a[1],a[2],a[3],a[4]]
new = [0]*(5)
s = 0
for i in range(5):
    new[i] = int(a[i][-1])
ans = min([e for e in new if e !=0])
for p in ls:
    if int(p) % 10 ==0:
        s += int(p)
    else:
        s += ((int(p)//10) + 1) *10
print(s-10+ans)
        