t = []
for i in range(5):
    t.append(int(input()))

saigo = 9
for i in range(5):
    if t[i] % 10 != 0:
        saigo = min(saigo,t[i]%10)

jikan = 0
for i in range(5):
    if t[i] % 10 == 0:
        jikan += t[i]
    else:
        jikan += t[i] + 10 - t[i]%10

jikan -= 10 - saigo
print(jikan)