a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
x=[(i,i%10) for i in [a,b,c,d,e] if i%10!=0]
y=[i for i in [a,b,c,d,e] if i%10==0]
x=sorted(x,key=lambda x:x[1])
ans = sum(y)
ans += sum((i[0]//10+1)*10 for i in x[1:])
ans+=x[0][0]
print(ans)