li = [int(input()) for _ in range(5)]

time = 0
non10li = []
for i in li:
    if i%10==0:
        time+=i
    else:
        non10li.append(i)

minili = [i%10 for i in non10li]
ind = non10li.pop(minili.index(min(minili)))
for i in non10li:
    time+=(i//10)*10+10

time+=ind
print(time)
