import math

data=[]
for i in range(5):
    data.append(int(input()))

ans=[10-i%10 for i in data]
check=ans.index(max(ans))
X=data.pop(check)

data=[math.ceil(x/10)*10 for x in data]
print(sum(data)+X