a = [int(input()) for i in range(5)]
A = [j%10 for j in a if j%10 != 0]
if A:p=sum(A)
else:p=0
b = sum([((k//10)+1)*10 for k in a if k%10 != 0])
b += sum([l for l in a if l%10 ==0])
if p:print(b-(10-p))
else:print(b)