p={} #調理時間
q={} #調理時間/10のあまり
r={} #注文-次の注文までの時間
for i in range(5):
    p[i] = int(input())
    q[i] = p[i] % 10
    if q[i] != 0:
        r[i] = p[i] + 10 - q[i]

maxloss = 0
maxlossnum = 0
for i in range(5):
    if maxloss < r[i] - p[i]:
        maxloss = r[i] - p[i]
        maxlossnum = i

time = int(0)
for i in range(5):
    if i != maxlossnum:
        time += r[i]
    else:
        time += p[i]

print(time)