mod0 = []
lst = []
for i in range(5):
    inp = int(input())
    if inp % 10 == 0:
        mod0.append(inp)
    else:
        lst.append([inp, inp % 10])
ans = sum(mod0)
lst.sort(key= lambda x :x[1])
last = lst.pop(0)
ans = sum(mod0)
for i,imod in lst:
    ans += (i//10 +1)*10

ans+=last[0]
print(ans)
