minv = 9
time = 0
for i in range(5):
    p = int(input())
    if p%10 >0:
        minv = min(minv,p%10)
        q = (p//10)*10+10
        time += q
    else:
        time+= p
time -=10-minv
print(time)
    