import sys
dishes = [int(input()) for _ in range(5)]
min_ = min([(d%10,d) for d in dishes if d%10>0])

ans = min_[1]
dishes.remove(min_[1])
for d in dishes:
    if d%10==0:
        ans += d
    else:
        ans += (d//10+1)*10
print(ans)
