l = []
for i in range(5):
    l.append(int(input()))
amari = []
for i in range(5):
    amari.append(l[i]%10)
jikan = []
for i in range(5):
    if amari[i] == 0:
        jikan.append(l[i])
    else :
        jikan.append(l[i] + (10-amari[i]))

print(sum(jikan) - (10-min(amari)))
