t = [int(input()) for i in range(5)]
r = [0] * 5
q = 0

for i in range(5):
    tr = t[i] % 10
    tq = t[i] // 10
    if tr == 0:
        r[i] = 10
        q += tq
    else:
        r[i] = tr
        q += tq + 1

if min(r) != 10:
    q -= 1

print(q * 10 + min(r))