ls = []
mod = []
for i in range(5):
    ls.append(int(input()))
    mod.append(ls[i]%10)

def roundup(n):
    if n % 10 < 5:
        return round(n+4,-1)
    else:
        return round(n,-1)


last_index = mod.index(min(mod))
sum = 0
for j in range(5):
    if j == last_index:
        sum += ls[j]
    else:
        sum += roundup(ls[j])
print(sum)
