t=[int(input()) for _ in range(5)]
s=[]
for i in range(5):
    s.append(t[i]%10)
    t[i]=-(-t[i]//10)*10
s=sorted(s)
ans=sum(t)-10
cnt=0
for i in range(len(s)):
    if s[i]!=0:
        ans+=s[i]
        break
    else:cnt+=1
if cnt>0:
    ans+=10
print(ans)