l = [int(input()) for _ in range(5)]
m = 100
ind = 100
res = 0
for i in range(5):
    if l[i]%10 == 0:
        continue
    if l[i]%10 < m:
        m = l[i]%10
        ind = i
for i in range(5):
    if i == ind:
        continue
    else:
        res += -(-l[i]//10)*10
res += l[ind]
print(res)
