a = [int(input()) for i in range(5)]
mod = []
for d in a:
    mod.append(d %10)
for i in range(5):
    for j in range(13):
        if j*10< a[i] <=( j+1)*10:
            a[i] = (j+1) *10

m = 10
for i in mod:
    if i != 0 and i <=m:
        m = i
if m >= 10:
    m = 0
print((sum(a) - (10 - m)))