a = [int(input()) for i in range(5)]
key = a[0]%10
last =10-a[0]
for i in range(1,5):
    x=10-a[i]%10
    if x >= key:
        if a[i]>=last:
            last=a[i]
        key=x
a.pop(a.index(last))
modtotal=0
for i in a:
    modtotal+=10-i%10
total=sum(a)+modtotal+last
print(total)