waitTime = []
_time = 0
for i in range(0,5):
    t, mod = divmod(int(input()), 10)
    _time += (t * 10)
    if mod != 0:
        waitTime.append(mod)
waitTime = sorted(waitTime, reverse= True)
_time += (len(waitTime) - 1) * 10
_time += min(waitTime)
print(_time)
