li = list()
li2 = list()
for _ in range(5):
    tmp = int(input())
    if(tmp % 10 == 0):
        li2.append(tmp)
    else:
        li.append(tmp)
li.sort(key=lambda x: x % 10, reverse=True)
li2.sort()
ans = sum(li2)
for i in range(len(li)-1):
    ans = ans + ((li[i] // 10 + 1) * 10)
ans += li[-1]
print(ans)
