def more(n):
    n=int(n)
    a=n//10
    b=(a+1)*10
    return b
info=[]
for i in range(5):
    a=int(input())
    info.append([a,more(a),more(a)-a])
#print(info)
info2=sorted(info,key=lambda x:x[2])
#print(info2)
total=info2[4][1]
print(total+sum(info2[i][0] for i in range(4)))