ls = [int(input()) for i in range(5)]
ans = []
num = 0
minNum = 10
    
for j in ls:
    x = j % 10
    if x < minNum and x != 0:
        num = j
        minNum = x
ans.append(num)
ls.pop(ls.index(num))

for i in ls:
    y = ((i + 9) // 10) * 10
    ans.append(y)


print(sum(ans))