l = [int(input())for i in range(5)]
ans = 0
amari = []
for i in l:
    amari.append(i%10)
amarii = sorted(amari,reverse=True)
amamari = []
for j in amarii:
    amamari.append(10-j)
sumsum = sum(l)
sumsumamari = sum(amamari[:4])
ans = sumsum+sumsumamari
print(ans)