s = 0
mod = 0
for _ in range(5):
    i = int(input())
    m = i % 10
    if m != 0:
        if mod == 0:
            mod = m
        else:
            mod = min(mod, m)
        s += (i // 10 + 1) * 10
    else:
        s += i
s = s - 10 + mod

print(s)

