i = [int(input()) for i in range(5)]
min = 9
count = 0
for x in i:
    if 0 < x % 10 < min % 10:
        min = x
        count += 1
if count > 0:
    i.remove(min)

for x in i:
    if x % 10 != 0:
        index = i.index(x)
        x += 10 - x % 10
        i[index] = x

if count > 0:
    i.append(min)

print(sum(i))
