x = []
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
tmp = 9
ans = 0


def a(b):
    c = str(b)
    if c[-1] == "0":
        return b
    else:
        return b - int(c[-1]) + 10


for i in x:
    ans += a(i)
    d = str(i)
    if int(d[-1]) != 0:
        tmp = min(tmp, int(d[-1]))

print(ans - (10 - tmp))
